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(); } } }
DeviceData data = new DeviceData(); data.tracking = true; display = new Display( data ); Sleak sleak = new Sleak(); Shell sleakShell = new Shell( display ); sleakShell.setText( "S-Leak" ); org.eclipse.swt.graphics.Point size = sleakShell.getSize(); sleakShell.setSize( size.x / 2, size.y / 2 ); sleak.create( sleakShell ); sleakShell.open(); } else { display = new Display();
public void createDialog( String title, String url, int options, Image logo ) { Shell parent = getParent(); display = parent.getDisplay(); dialog = new Shell( parent, options ); dialog.setText( title ); dialog.setImage( logo ); dialog.setSize( width, height ); dialog.setLayout( new FillLayout() ); try { browser = new Browser( dialog, SWT.NONE ); browser.setUrl( url ); browser.addCloseWindowListener( new CloseWindowListener() { @Override public void close( WindowEvent event ) { Browser browser = (Browser) event.widget; Shell shell = browser.getShell(); shell.close(); } } ); } catch ( Exception e ) { MessageBox messageBox = new MessageBox( dialog, SWT.ICON_ERROR | SWT.OK ); messageBox.setMessage( "Browser cannot be initialized." ); messageBox.setText( "Exit" ); messageBox.open(); } setPosition(); dialog.open(); }
Shell shell = new Shell(display); try { shell.setSize(200, 100); shell.setLayout(new FillLayout()); createComponents(shell); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); if (!shell.isDisposed()) { shell.dispose();
Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); shell.setSize(1000,400); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep();
Display display = new Display(); final Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new FillLayout()); shell.setSize(100, shell.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); shell.open(); while (!shell.isDisposed())
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(); } } }
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(); }
public static void main( String[] args ) { Display display = new Display(); Shell shell = new Shell( display ); shell.setLayout( new FillLayout() ); final Table table = new Table( shell, SWT.VIRTUAL ); table.setItemCount( 10000 ); table.addListener( SWT.SetData, new Listener() { public void handleEvent( Event event ) { TableItem item = (TableItem)event.item; item.setText( "Item " + table.indexOf( item ) ); } } ); shell.setSize( 300, 500 ); shell.open(); while( !shell.isDisposed() ) { if( !display.readAndDispatch() ) { display.sleep(); } } display.dispose(); }
public static void main( String[] args ) { DeviceData data = new DeviceData(); data.tracking = true; Display display = new Display( data ); Sleak sleak = new Sleak(); Shell shell = new Shell( display ); shell.setText( "S-Leak" ); Point size = shell.getSize(); shell.setSize( size.x / 2, size.y / 2 ); sleak.create( shell ); shell.open(); // Launch your application here // e.g. // Shell shell = new Shell(display); // Button button1 = new Button(shell, SWT.PUSH); // button1.setBounds(10, 10, 100, 50); // button1.setText("Hello World"); // Image image = new Image(display, 20, 20); // Button button2 = new Button(shell, SWT.PUSH); // button2.setBounds(10, 70, 100, 50); // button2.setImage(image); // shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } display.dispose(); }
Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); shell.setText("Hide Label"); shell.setSize(200, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep();
public void sampleApp(Shell shell) { shell.setLayout(new FillLayout()); shell.setText("Hello"); JLabel lab=new JLabel("Hello World"); Label username_checkout=new Label(shell, SWT.BOLD); username_checkout.setText("User Name"); Button button=new Button(shell,SWT.PUSH); button.setText("push"); shell.setSize(270,270); shell.open(); }
Display display = new Display (); shell.setSize (200, 200); shell.open (); while (!shell.isDisposed()) { if (!display.readAndDispatch ()) display.sleep ();
public JobEntryInterface open() { Shell parent = getParent(); display = parent.getDisplay(); shell = new Shell( parent, props.getJobsDialogStyle() ); props.setLook( shell ); JobDialog.setShellImage( shell, jobEntry ); backupChanged = jobEntry.hasChanged(); createElements(); // Detect [X] or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed( ShellEvent e ) { cancel(); } } ); getData(); setActive(); BaseStepDialog.setSize( shell ); int width = 750; int height = Const.isWindows() ? 730 : 718; shell.setSize( width, height ); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } return jobEntry; }
public JobEntryInterface open() { Shell parent = getParent(); display = parent.getDisplay(); shell = new Shell( parent, props.getJobsDialogStyle() ); props.setLook( shell ); JobDialog.setShellImage( shell, jobEntry ); backupChanged = jobEntry.hasChanged(); createElements(); // Detect [X] or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed( ShellEvent e ) { cancel(); } } ); getData(); setActive(); BaseStepDialog.setSize( shell ); int width = 750; int height = Const.isWindows() ? 730 : 720; shell.setSize( width, height ); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } return jobEntry; }
if ( this.getParent().isDisposed() ) { return; formLayout.marginWidth = margin; formLayout.marginHeight = margin; shell.setLayout( formLayout ); // setting layout shell.setSize( shell.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ) ); Rectangle screenSize = display.getPrimaryMonitor().getBounds(); shell.setLocation( ( screenSize.width - shell.getBounds().width ) / 2, ( screenSize.height - shell.getBounds().height ) / 2 ); closeButton.setFocus(); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep();
shell.setLayout( new FormLayout() ); shell.setText( title ); props.setLook( shell ); shell.setSize( point ); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep();