private void open( final Display display ) { shell.pack(); if ( width > 0 ) { final int height = shell.computeSize( width, SWT.DEFAULT ).y; // for some reason the actual width and minimum width are smaller than what is requested - add the // SHELL_WIDTH_OFFSET to get the desired size shell.setMinimumSize( width + SHELL_WIDTH_OFFSET, height ); shell.setSize( width + SHELL_WIDTH_OFFSET, height ); } shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } }
public void widgetSelected( SelectionEvent e ) { final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM ); dialog.setText( BaseMessages.getString( PKG, "JobGetPOP.SelectDate" ) ); dialog.setImage( GUIResource.getInstance().getImageSpoon() ); dialog.setLayout( new GridLayout( 3, false ) ); final DateTime calendar = new DateTime( dialog, SWT.CALENDAR ); final DateTime time = new DateTime( dialog, SWT.TIME | SWT.TIME ); new Label( dialog, SWT.NONE ); new Label( dialog, SWT.NONE ); Button ok = new Button( dialog, SWT.PUSH ); ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) ); ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) ); ok.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { Calendar cal = Calendar.getInstance(); cal.set( Calendar.YEAR, calendar.getYear() ); cal.set( Calendar.MONTH, calendar.getMonth() ); cal.set( Calendar.DAY_OF_MONTH, calendar.getDay() ); cal.set( Calendar.HOUR_OF_DAY, time.getHours() ); cal.set( Calendar.MINUTE, time.getMinutes() ); cal.set( Calendar.SECOND, time.getSeconds() ); wReadFrom.setText( new SimpleDateFormat( JobEntryGetPOP.DATE_PATTERN ).format( cal.getTime() ) ); dialog.close(); } } ); dialog.setDefaultButton( ok ); dialog.pack(); dialog.open(); } } );
Display display = new Display(); Shell shell1 = openDocumentShell(display); Shell shell2 = openDocumentShell(display); while (!shell1.isDisposed() || !shell2.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); shell.setLayout(new FillLayout()); Button button = new Button(shell, SWT.PUSH); button.setText("Open Modal Dialog"); System.out.println("Button pressed, about to open modal dialog"); final Shell dialogShell = new Shell(shell, SWT.PRIMARY_MODAL | SWT.SHEET); dialogShell.setLayout(new FillLayout()); Button closeButton = new Button(dialogShell, SWT.PUSH); closeButton.setText("Close"); dialogShell.pack(); dialogShell.open(); shell.pack(); shell.open(); return shell;
protected void openDialog() { shell.pack(); // Set the focus on the OK button wOK.setFocus(); Rectangle shellBounds = getParent().getBounds(); Point dialogSize = shell.getSize(); shell.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y + ( shellBounds.height - dialogSize.y ) / 2 ); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } }
public void widgetSelected( SelectionEvent e ) { final Shell dialog = new Shell( shell, SWT.DIALOG_TRIM ); dialog.setText( BaseMessages.getString( PKG, "MailInput.SelectDate" ) ); dialog.setImage( GUIResource.getInstance().getImageSpoon() ); dialog.setLayout( new GridLayout( 3, false ) ); final DateTime calendar = new DateTime( dialog, SWT.CALENDAR ); final DateTime time = new DateTime( dialog, SWT.TIME | SWT.TIME ); new Label( dialog, SWT.NONE ); new Label( dialog, SWT.NONE ); Button ok = new Button( dialog, SWT.PUSH ); ok.setText( BaseMessages.getString( PKG, "System.Button.OK" ) ); ok.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) ); ok.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { Calendar cal = Calendar.getInstance(); cal.set( Calendar.YEAR, calendar.getYear() ); cal.set( Calendar.MONTH, calendar.getMonth() ); cal.set( Calendar.DAY_OF_MONTH, calendar.getDay() ); cal.set( Calendar.HOUR_OF_DAY, time.getHours() ); cal.set( Calendar.MINUTE, time.getMinutes() ); cal.set( Calendar.SECOND, time.getSeconds() ); wReadFrom.setText( new SimpleDateFormat( MailInputMeta.DATE_PATTERN ).format( cal.getTime() ) ); dialog.close(); } } ); dialog.setDefaultButton( ok ); dialog.pack(); dialog.open(); } } );
public static void main(String args[]) { Display display = new Display(); final Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new GridLayout(1, false)); Label bottom = new Label(shell, SWT.NONE); bottom.setText("Bottom"); Label top = new Label(shell, SWT.NONE); top.setText("Top"); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!shell.getDisplay().readAndDispatch()) shell.getDisplay().sleep(); } }
private void open( final Display display ) { shell.pack(); final int height = shell.computeSize( SHELL_WIDTH, SWT.DEFAULT ).y; // for some reason the actual width and minimum width are smaller than what is requested - add the // SHELL_WIDTH_OFFSET to get the desired size shell.setMinimumSize( SHELL_WIDTH + BaseDialog.SHELL_WIDTH_OFFSET, height ); shell.setSize( SHELL_WIDTH + BaseDialog.SHELL_WIDTH_OFFSET, height ); getData( meta ); meta.setChanged( changed ); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } }
formLayout.marginHeight = 15; shell.setLayout( formLayout ); shell.setText( BaseMessages.getString( PKG, "RunConfigurationDeleteDialog.Title" ) ); shell.setImage( getImage() ); shell.pack( true ); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep();
shell.setLayout( formLayout ); shell.pack( true ); long startTime = new Date().getTime(); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep();
public void widgetSelected( SelectionEvent e ) { final Shell dialogto = new Shell( shell, SWT.DIALOG_TRIM ); dialogto.setText( BaseMessages.getString( PKG, "MailInput.SelectDate" ) ); dialogto.setImage( GUIResource.getInstance().getImageSpoon() ); dialogto.setLayout( new GridLayout( 3, false ) ); final DateTime calendarto = new DateTime( dialogto, SWT.CALENDAR | SWT.BORDER ); final DateTime timeto = new DateTime( dialogto, SWT.TIME | SWT.TIME ); new Label( dialogto, SWT.NONE ); new Label( dialogto, SWT.NONE ); Button okto = new Button( dialogto, SWT.PUSH ); okto.setText( BaseMessages.getString( PKG, "System.Button.OK" ) ); okto.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) ); okto.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { Calendar cal = Calendar.getInstance(); cal.set( Calendar.YEAR, calendarto.getYear() ); cal.set( Calendar.MONTH, calendarto.getMonth() ); cal.set( Calendar.DAY_OF_MONTH, calendarto.getDay() ); cal.set( Calendar.HOUR_OF_DAY, timeto.getHours() ); cal.set( Calendar.MINUTE, timeto.getMinutes() ); cal.set( Calendar.SECOND, timeto.getSeconds() ); wReadTo.setText( new SimpleDateFormat( MailInputMeta.DATE_PATTERN ).format( cal.getTime() ) ); dialogto.close(); } } ); dialogto.setDefaultButton( okto ); dialogto.pack(); dialogto.open(); } } );
shell.setLayout( formLayout ); shell.pack(); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep();
public void widgetSelected( SelectionEvent e ) { final Shell dialogto = new Shell( shell, SWT.DIALOG_TRIM ); dialogto.setText( BaseMessages.getString( PKG, "JobGetPOP.SelectDate" ) ); dialogto.setImage( GUIResource.getInstance().getImageSpoon() ); dialogto.setLayout( new GridLayout( 3, false ) ); final DateTime calendarto = new DateTime( dialogto, SWT.CALENDAR | SWT.BORDER ); final DateTime timeto = new DateTime( dialogto, SWT.TIME | SWT.TIME ); new Label( dialogto, SWT.NONE ); new Label( dialogto, SWT.NONE ); Button okto = new Button( dialogto, SWT.PUSH ); okto.setText( BaseMessages.getString( PKG, "System.Button.OK" ) ); okto.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, false, false ) ); okto.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent e ) { Calendar cal = Calendar.getInstance(); cal.set( Calendar.YEAR, calendarto.getYear() ); cal.set( Calendar.MONTH, calendarto.getMonth() ); cal.set( Calendar.DAY_OF_MONTH, calendarto.getDay() ); cal.set( Calendar.HOUR_OF_DAY, timeto.getHours() ); cal.set( Calendar.MINUTE, timeto.getMinutes() ); cal.set( Calendar.SECOND, timeto.getSeconds() ); wReadTo.setText( new SimpleDateFormat( JobEntryGetPOP.DATE_PATTERN ).format( cal.getTime() ) ); dialogto.close(); } } ); dialogto.setDefaultButton( okto ); dialogto.pack(); dialogto.open(); } } );
shell.setLayout( formLayout ); shell.pack(); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep();
formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout( formLayout ); shell.setImage( GUIResource.getInstance().getImageSpoon() ); shell.setText( shellText ); shell.pack(); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep();
public void open() { shell = new Shell( display ); shell.setLayout( new FillLayout() ); shell.setText( APP_NAME ); shell.setImage( GUIResource.getInstance().getImageLogoSmall() ); try { readFiles(); } catch ( Exception e ) { new ErrorDialog( shell, "Error reading translations", "There was an unexpected error reading the translations", e ); } // Put something on the screen sashform = new SashForm( shell, SWT.HORIZONTAL ); sashform.setLayout( new FormLayout() ); addLists(); addGrid(); addListeners(); sashform.setWeights( new int[] { 40, 60 } ); sashform.setVisible( true ); shell.pack(); refresh(); shell.setSize( 1024, 768 ); shell.open(); }
formLayout.marginHeight = BaseDialog.MARGIN_SIZE; shell.setLayout( formLayout ); shell.setText( shellText ); shell.pack(); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep();