Java Code Examples for org.eclipse.swt.widgets.Display#dispose()

The following examples show how to use org.eclipse.swt.widgets.Display#dispose() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CDTSnippet05.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @param args
 */
public static void main(String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setText("CDateTime");
	shell.setLayout(new GridLayout());

	final CDateTime cdt = new CDateTime(shell, CDT.BORDER | CDT.DROP_DOWN | CDT.TIME_SHORT | CDT.CLOCK_DISCRETE);
	cdt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
       
	shell.pack();
	Point size = shell.getSize();
	Rectangle screen = display.getMonitors()[0].getBounds();
	shell.setBounds(
			(screen.width-size.x)/2,
			(screen.height-size.y)/2,
			size.x,
			size.y
	);
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}
 
Example 2
Source File: HorizontalSpinnerSnippet.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public static void main(final String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setLayout(new GridLayout(4, true));

	createSpinnerGroup(shell);
	createHorizontalSpinnerGroup(shell, "Default look", SWT.NONE);
	createHorizontalSpinnerGroup(shell, "Buttons on the left", SWT.LEFT);
	createHorizontalSpinnerGroup(shell, "Buttons on the right", SWT.RIGHT);

	shell.pack();
	shell.open();

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
	display.dispose();

}
 
Example 3
Source File: GridSnippet1.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public static void main (String [] args) {
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setLayout(new FillLayout());

    Grid grid = new Grid(shell,/*SWT.BORDER |*/ SWT.V_SCROLL | SWT.H_SCROLL);
  //  grid.setHeaderVisible(true);
    GridColumn column = new GridColumn(grid,SWT.NONE);
   // column.setTree(true);
   // column.setText("Column 1");
  //  column.setWidth(100);
    GridItem item1 = new GridItem(grid,SWT.NONE);
    item1.setText("Root Item");
    GridItem item2 = new GridItem(grid,SWT.NONE);
    item2.setText("Second item");
    GridItem item3 = new GridItem(grid,SWT.NONE);
    item3.setText("Third Item");
    
    shell.setSize(200,200);
    shell.open ();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
}
 
Example 4
Source File: DateFormatterSnippet1.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	Display display = new Display();
   Shell shell = new Shell(display);
   shell.setLayout(new GridLayout());

   Locale.setDefault(Locale.US);
   FormattedText text = new FormattedText(shell, SWT.BORDER);
   text.setFormatter(new DateFormatter());
   GridData data = new GridData();
   data.widthHint = 70;
   text.getControl().setLayoutData(data);

   shell.open();
   while ( ! shell.isDisposed() ) {
   	if (!display.readAndDispatch()) display.sleep();
   }
   display.dispose();
}
 
Example 5
Source File: CalendarComboTester.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @param args
 */
public static void main(String[] args) {
   Display display = new Display();
   Shell shell = new Shell(display);
   shell.setText("Button Composite Tester");
   shell.setSize(200, 400);

   shell.setLayout(new FillLayout());
   Composite inner = new Composite(shell, SWT.None);
   GridLayout gl = new GridLayout(1, true);
   inner.setLayout(gl);

   createExample(inner);

   shell.open();

   while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
         display.sleep();
      }
   }
   display.dispose();
}
 
Example 6
Source File: Snippet6.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Executes the snippet.
 *
 * @param args
 *            command-line args.
 */
public static void main(String[] args) {
	Display display = Display.getDefault();
	final Shell shell = new Shell(display);
	shell.setText("Snippet6.java");
	shell.setBounds(100, 100, 640, 480);
	shell.setLayout(new GridLayout());

	Button button = new Button(shell, SWT.PUSH);
	button.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
	button.setText("Print");

	PrintViewer viewer = new PrintViewer(shell, SWT.BORDER);
	viewer.getControl()
			.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	final Print print = createPrint();
	viewer.setPrint(print);

	button.addListener(SWT.Selection, event -> {
		PrintDialog dialog = new PrintDialog(shell, SWT.NONE);
		PrinterData printerData = dialog.open();
		if (printerData != null)
			PaperClips.print(
					new PrintJob("Snippet6.java", print).setMargins(72),
					printerData);
	});

	shell.setVisible(true);

	while (!shell.isDisposed())
		if (!display.readAndDispatch())
			display.sleep();

	display.dispose();
}
 
Example 7
Source File: SnippetSimpleNoGroup.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	Display display = new Display();
	Image itemImage = new Image(display, Program.findProgram("jpg").getImageData()); //$NON-NLS-1$

	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	Gallery gallery = new Gallery(shell, SWT.V_SCROLL | SWT.MULTI);

	// Renderers
	NoGroupRenderer gr = new NoGroupRenderer();
	gr.setMinMargin(2);
	gr.setItemHeight(56);
	gr.setItemWidth(72);
	gr.setAutoMargin(true);
	gallery.setGroupRenderer(gr);

	DefaultGalleryItemRenderer ir = new DefaultGalleryItemRenderer();
	gallery.setItemRenderer(ir);

	GalleryItem group = new GalleryItem(gallery, SWT.NONE);

	for (int i = 0; i < 100; i++) {
		GalleryItem item = new GalleryItem(group, SWT.NONE);
		if (itemImage != null) {
			item.setImage(itemImage);
		}
		item.setText("Item " + i); //$NON-NLS-1$
	}

	shell.pack();
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}

	if (itemImage != null)
		itemImage.dispose();
	display.dispose();
}
 
Example 8
Source File: BonitaStudioApplication.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected Object createAndRunWorkbench(final Display display) {
    try {
        final int returnCode = PlatformUI.createAndRunWorkbench(display, createWorkbenchAdvisor());
        if (returnCode == PlatformUI.RETURN_RESTART) {
            return IApplication.EXIT_RESTART;
        }
        return IApplication.EXIT_OK;
    } finally {
        display.dispose();
    }
}
 
Example 9
Source File: ExamplesApplication.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Object start(IApplicationContext context) {
	Display display = PlatformUI.createDisplay();
	try {
		int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
		if (returnCode == PlatformUI.RETURN_RESTART) {
			return IApplication.EXIT_RESTART;
		}
		return IApplication.EXIT_OK;
	} finally {
		display.dispose();
	}
}
 
Example 10
Source File: CarouselSnippet.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @param args
 */
public static void main(final String[] args) {
	final Display display = new Display();
	shell = new Shell(display);
	shell.setText("Carousel Snippet");
	shell.setLayout(new FillLayout());
	shell.setBackground(display.getSystemColor(SWT.COLOR_WHITE));

	final Carousel carousel = new Carousel(shell, SWT.NONE);
	carousel.addImage(loadImage("images/first.png"));
	carousel.addImage(loadImage("images/second.jpg"));
	carousel.addImage(loadImage("images/third.png"));

	final Listener listener = event -> {
		System.out.println("Click on " + carousel.getSelection());
	};
	carousel.addListener(SWT.Selection, listener);

	shell.pack();
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}

	display.dispose();

}
 
Example 11
Source File: ManageableTableTreeEx.java    From SWET with MIT License 5 votes vote down vote up
public void run() {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setText("TableTree Test");
	createContents(shell);
	shell.pack();
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
	display.dispose();
}
 
Example 12
Source File: ModelSortPageableTreeExample.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public static void main(String[] args) {

		Display display = new Display();
		Shell shell = new Shell(display);
		GridLayout layout = new GridLayout(1, false);
		shell.setLayout(layout);

		final List<Team> items = createList();

		// 1) Create pageable tree with 10 items per page
		// This SWT Component create internally a SWT Tree+JFace TreeViewer
		int pageSize = 10;
		PageableTree pageableTree = new PageableTree(shell, SWT.BORDER,
				SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, pageSize);
		pageableTree.setLayoutData(new GridData(GridData.FILL_BOTH));

		// 2) Initialize the tree viewer + SWT Tree
		TreeViewer viewer = pageableTree.getViewer();
		viewer.setContentProvider(TeamContentProvider.getInstance());
		viewer.setLabelProvider(new LabelProvider());

		Tree tree = viewer.getTree();
		tree.setHeaderVisible(true);
		tree.setLinesVisible(true);

		// 3) Create Tree columns with sort of paginated list.
		createColumns(viewer);

		// 3) Set current page to 0 to refresh the tree
		pageableTree.setPageLoader(new PageResultLoaderList<Team>(items));
		pageableTree.setCurrentPage(0);

		shell.setSize(400, 250);
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
 
Example 13
Source File: Regression_143809_swt.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * main() method for constructing the layout.
 * 
 * @param args
 */
public static void main( String[] args )
{
	Display display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setSize( 600, 400 );
	shell.setLayout( new GridLayout( ) );

	Regression_143809_swt siv = new Regression_143809_swt(
			shell,
			SWT.NO_BACKGROUND );
	siv.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	siv.addPaintListener( siv );

	Composite cBottom = new Composite( shell, SWT.NONE );
	cBottom.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	cBottom.setLayout( new RowLayout( ) );

	Label la = new Label( cBottom, SWT.NONE );

	la.setText( "Choose: " );//$NON-NLS-1$
	cbType = new Combo( cBottom, SWT.DROP_DOWN | SWT.READ_ONLY );
	cbType.add( "Pie Chart" );
	cbType.select( 0 );

	btn = new Button( cBottom, SWT.NONE );
	btn.setText( "Update" );//$NON-NLS-1$
	btn.addSelectionListener( siv );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 14
Source File: PrintDialogExample.java    From http4e with Apache License 2.0 4 votes vote down vote up
PrintDialogExample() {
  d = new Display();
  s = new Shell(d);
  s.setSize(400, 400);
  
  s.setText("A PrintDialog Example");
  s.setLayout(new FillLayout(SWT.VERTICAL));
  final Text t = new Text(s, SWT.BORDER | SWT.MULTI);
  final Button b = new Button(s, SWT.PUSH | SWT.BORDER);
  b.setText("Print");
  b.addSelectionListener(new SelectionAdapter() {
    public void widgetSelected(SelectionEvent e) {
      PrintDialog printDialog = new PrintDialog(s, SWT.NONE);
      printDialog.setText("Print");
      PrinterData printerData = printDialog.open();
      if (!(printerData == null)) {
        Printer p = new Printer(printerData);
        p.startJob("PrintJob");
        p.startPage();
        Rectangle trim = p.computeTrim(0, 0, 0, 0);
        Point dpi = p.getDPI();
        int leftMargin = dpi.x + trim.x;
        int topMargin = dpi.y / 2 + trim.y;
        GC gc = new GC(p);
        Font font = gc.getFont();
        String printText = t.getText();
        Point extent = gc.stringExtent(printText);
        gc.drawString(printText, leftMargin, topMargin
            + font.getFontData()[0].getHeight());
        p.endPage();
        gc.dispose();
        p.endJob();
        p.dispose();
      }
    }
  });
  s.open();

  while (!s.isDisposed()) {
    if (!d.readAndDispatch())
      d.sleep();
  }
  d.dispose();
}
 
Example 15
Source File: SnippetCheckBoxGroup.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public static void main(final String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
	final FillLayout layout1 = new FillLayout(SWT.VERTICAL);
	layout1.marginWidth = layout1.marginHeight = 10;
	shell.setLayout(layout1);

	// Displays the group
	final CheckBoxGroup group = new CheckBoxGroup(shell, SWT.NONE);
	group.setLayout(new GridLayout(4, false));
	group.setText("Use proxy server");

	final Composite content = group.getContent();

	final Label lblServer = new Label(content, SWT.NONE);
	lblServer.setText("Server:");
	lblServer.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));

	final Text txtServer = new Text(content, SWT.NONE);
	txtServer.setText("proxy.host.com");
	txtServer.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	final Label lblPort = new Label(content, SWT.NONE);
	lblPort.setText("Port:");
	lblPort.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));

	final Text txtPort = new Text(content, SWT.NONE);
	txtPort.setText("1234");
	txtPort.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	final Label lblUser = new Label(content, SWT.NONE);
	lblUser.setText("User ID:");
	lblUser.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));

	final Text txtUser = new Text(content, SWT.NONE);
	txtUser.setText("MyName");
	txtUser.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	final Label lblPassword = new Label(content, SWT.NONE);
	lblPassword.setText("Password:");
	lblPassword.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));

	final Text txtPassword = new Text(content, SWT.PASSWORD);
	txtPassword.setText("password");
	txtPassword.setEnabled(false);
	txtPassword.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	// Open the shell
	shell.setSize(640, 360);
	SWTGraphicUtil.centerShell(shell);
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
	display.dispose();
}
 
Example 16
Source File: GridSnippet10.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public static void main (String [] args) {
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setLayout(new FillLayout());

    Grid grid = new Grid(shell,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    grid.setHeaderVisible(true);
    GridColumn column = new GridColumn(grid,SWT.NONE);
    column.setTree(true);
    column.setText("Column 1");
    column.setWidth(100);
    GridColumn column2 = new GridColumn(grid,SWT.NONE);
    column2.setTree(true);
    column2.setText("Column 1");
    column2.setWidth(100);
    GridColumn column3 = new GridColumn(grid,SWT.NONE);
    column3.setTree(true);
    column3.setText("Column 3");
    column3.setWidth(100);

    GridItem item1 = new GridItem(grid,SWT.NONE);
    item1.setText(0,"Root Item1");
    item1.setText(1,"Root Item2");
    item1.setText(2,"Root Item3");
    GridItem item2 = new GridItem(item1,SWT.NONE);
    item2.setText(0,"Second item1");
    item2.setText(1,"Second item2");
    item2.setText(2,"Second item3");
    GridItem item3 = new GridItem(item2,SWT.NONE);
    item3.setText(0,"Third Item1");
    item3.setText(1,"Third Item2");
    item3.setText(2,"Third Item3");

    grid.setCellSelectionEnabled(true);

    //add the "win7" column header rendering
    Win7RendererSupport.create(grid).decorate();

    shell.setSize(200,200);
    shell.open ();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
}
 
Example 17
Source File: GridPrintVerticalAlignmentExample.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Executes the GridPrint example.
 *
 * @param args
 *            the command line arguments.
 */
public static void main(String[] args) {
	final Display display = new Display();

	Shell shell = new Shell(display, SWT.SHELL_TRIM);
	shell.setText("GridPrintVerticalAlignmentExample.java");
	shell.setLayout(new GridLayout());
	shell.setSize(600, 800);

	final PrintJob job = new PrintJob(
			"GridPrintVerticalAlignmentExample.java", createPrint());

	Composite buttonPanel = new Composite(shell, SWT.NONE);
	buttonPanel
			.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	buttonPanel.setLayout(new RowLayout(SWT.HORIZONTAL));

	final PrintPreview preview = new PrintPreview(shell, SWT.BORDER);

	Button prev = new Button(buttonPanel, SWT.PUSH);
	prev.setText("<< Prev");
	prev.addListener(SWT.Selection, event -> {
		preview.setPageIndex(Math.max(preview.getPageIndex() - 1, 0));
	});

	Button next = new Button(buttonPanel, SWT.PUSH);
	next.setText("Next >>");
	next.addListener(SWT.Selection, event -> {
		preview.setPageIndex(Math.min(preview.getPageIndex() + 1,
				preview.getPageCount() - 1));
	});

	Button print = new Button(buttonPanel, SWT.PUSH);
	print.setText("Print");
	print.addListener(SWT.Selection, event -> {
		PaperClips.print(job, new PrinterData());
	});

	preview.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	preview.setFitHorizontal(true);
	preview.setFitVertical(true);
	preview.setPrintJob(job);

	shell.open();

	while (!shell.isDisposed())
		if (!display.readAndDispatch())
			display.sleep();

	display.dispose();
}
 
Example 18
Source File: CollapsibleButtonsSnippet1.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public static void main(String[] args) {
	Display display = new Display();

	Image itemImage24 = new Image(display, Program
			.findProgram("jpg").getImageData().scaledTo(24, 24)); //$NON-NLS-1$
	Image itemImage16 = new Image(display, Program
			.findProgram("jpg").getImageData().scaledTo(16, 16)); //$NON-NLS-1$

	Shell shell = new Shell(display);
	shell.setSize(400, 400);
	shell.setLayout(new FillLayout());

	Composite inner = new Composite(shell, SWT.NONE);
	GridLayout gl = new GridLayout(1, true);
	gl.marginBottom = 0;
	gl.marginHeight = 0;
	gl.marginWidth = 0;
	gl.marginHeight = 0;
	inner.setLayout(gl);

	CollapsibleButtons collapsibleButtons = new CollapsibleButtons(inner,
			SWT.NONE, IColorManager.SKIN_OFFICE_2007);
	collapsibleButtons.setLayoutData(new GridData(GridData.GRAB_VERTICAL
			| GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END));

	for (int i = 0; i < 5; i++) {
		collapsibleButtons.addButton("Button "+i, "Tooltip "+i, itemImage24,
				itemImage16);
	}
	
	shell.open();
	
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}

	display.dispose();
	itemImage16.dispose();
	itemImage24.dispose();
}
 
Example 19
Source File: ScopeExample.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public static void main(String [] args) {
	Display display = new Display ();
	Shell shell = new Shell (display);
	shell.setText("Gantt Chart - Scopes Example");
	shell.setSize(600, 500);		
	shell.setLayout(new FillLayout());
	
	// Create a chart
	GanttChart ganttChart = new GanttChart(shell, SWT.NONE);
	
	// Create a scope
	GanttEvent scopeEvent = new GanttEvent(ganttChart, "Scope of 3 events");		
	
	// Create some calendars
	Calendar sdEventOne = Calendar.getInstance();
	Calendar edEventOne = Calendar.getInstance();
	edEventOne.add(Calendar.DATE, 10); 

	Calendar sdEventTwo = Calendar.getInstance();
	Calendar edEventTwo = Calendar.getInstance();
	sdEventTwo.add(Calendar.DATE, 11);
	edEventTwo.add(Calendar.DATE, 15);

	Calendar cpDate = Calendar.getInstance();
	cpDate.add(Calendar.DATE, 16);

	// Create events
	GanttEvent eventOne = new GanttEvent(ganttChart, "Scope Event 1");		
	GanttEvent eventTwo = new GanttEvent(ganttChart, "Scope Event 2", sdEventTwo, edEventTwo, 10);		
	GanttEvent eventThree = new GanttEvent(ganttChart, "Checkpoint", cpDate, cpDate, 75);
	eventThree.setCheckpoint(true);

	// Add events to scope
	scopeEvent.addScopeEvent(eventOne);
	scopeEvent.addScopeEvent(eventTwo);
	scopeEvent.addScopeEvent(eventThree);
	
	eventOne.addScopeEvent(eventTwo);
	eventOne.addScopeEvent(eventThree);
			
	// Show chart
	shell.open();

	while (!shell.isDisposed ()) {
		if (!display.readAndDispatch ()) display.sleep ();
	}
	display.dispose ();
	
}
 
Example 20
Source File: Tester.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public static void main(String[] args) {
		Display display = new Display ();
		Shell shell = new Shell (display);
		shell.setText("Calendar Combo Tester");
		shell.setSize(200, 400);
		
		// allow other date formats than default
		class Settings extends DefaultSettings {
			
/*			public Locale getLocale() {
				//return Locale.GERMAN;
			}
*/
			public boolean keyboardNavigatesCalendar() {
				return false;
			}

			
		}
		
		shell.setLayout(new FillLayout());
		Composite inner = new Composite(shell, SWT.None);
		GridLayout gl = new GridLayout(1, true);		
		inner.setLayout(gl);

		Label foo = new Label(inner, SWT.NONE);
		foo.setText("Test");
		final CalendarCombo cc = new CalendarCombo(inner, SWT.NONE, new Settings(), null);
		cc.addCalendarListener(new ICalendarListener() {

			public void dateChanged(Calendar date) {
				if (date == null) {
					System.err.println("Date changed to null");
				}
				else {
					System.err.println("Date changed " + date.getTime());
				}
			}

			public void dateRangeChanged(Calendar start, Calendar end) {
			}

			public void popupClosed() {
			}
			
		});

		final CalendarCombo cc2 = new CalendarCombo(inner, SWT.READ_ONLY, new Settings(), null);

		Button b = new Button(inner, SWT.PUSH);
		b.setText("Check date");
		b.addListener(SWT.Selection, new Listener() {

			public void handleEvent(Event event) {
				System.err.println(cc.getDate().getTime());
			}
			
		});
	
		shell.open();

		while (!shell.isDisposed ()) {
			if (!display.readAndDispatch ()) display.sleep ();
		}
		display.dispose ();
	}