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(); }
shell.setText(RedisClient.i18nFile.getText(I18nFile.DONATION)); shell.setLayout(new GridLayout(1, false)); Composite composite = new Composite(shell, SWT.NONE); composite.setLayout(new GridLayout(1, false)); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Label lblNewLabel = new Label(composite, SWT.WRAP); lblNewLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lblNewLabel.setText(RedisClient.i18nFile.getText(I18nFile.DONATIONMESSAGE)); Label label = new Label(composite, SWT.NONE); Composite composite_1 = new Composite(shell, SWT.NONE); composite_1.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1)); composite_1.setLayout(new FillLayout(SWT.HORIZONTAL));
public String open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN ); props.setLook( shell ); shell.setLayout( shellLayout ); shell.setText( BaseMessages.getString( PKG, "GetRepositoryNamesDialog.DialogTitle" ) ); margin = Const.MARGIN; Composite sCompParent = new Composite( shell, SWT.NONE ); sCompParent.setLayout( new FillLayout( SWT.VERTICAL ) ); GridData sCompGridData = new GridData( GridData.FILL_BOTH ); sCompGridData.grabExcessHorizontalSpace = true; sCompGridData.grabExcessVerticalSpace = true; sCompParent.setLayoutData( sCompGridData ); wlStepname = new Label( comp, SWT.RIGHT ); wlStepname.setText( BaseMessages.getString( PKG, "System.Label.StepName" ) ); props.setLook( wlStepname ); fdlStepname = new FormData(); shell.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep();
scrolledComposite.setLayout( new FillLayout() ); Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE ); props.setLook( wInputComposite ); tabLayout.marginWidth = 15; tabLayout.marginHeight = 15; wInputComposite.setLayout( tabLayout ); wlResultFilesTarget = new Label( wInputComposite, SWT.RIGHT ); props.setLook( wlResultFilesTarget ); wlResultFilesTarget.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFilesTarget.Label" ) ); FormData fdlResultFilesTarget = new FormData(); fdlResultFilesTarget.top = new FormAttachment( 0, 0 ); fdlResultFilesTarget.left = new FormAttachment( 0, 0 ); // First one in the left wlResultFilesTarget.setLayoutData( fdlResultFilesTarget ); wResultFileNameField.setLayoutData( fdResultFileNameField ); wInputComposite.pack(); Rectangle bounds = wInputComposite.getBounds();
public static void main(String[] args) { Display display = Display.getDefault(); Shell shell = new Shell(display, SWT.DIALOG_TRIM); shell.setLayout(new FillLayout()); Composite c = new Composite(shell, SWT.BORDER); c.setLayout(new FillLayout()); c.addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.drawLine(0, 0, 100, 50); } }); Label lbl = new Label(c, SWT.NONE); lbl.setText("text"); 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 ); shell.setImage( GUIResource.getInstance().getImageStart() ); wlName = new Label( shell, SWT.RIGHT ); wlName.setText( BaseMessages.getString( PKG, "JobSpecial.Jobname.Label" ) ); props.setLook( wlName ); fdlName = new FormData(); wIntervalSeconds ); Composite time = new Composite( shell, SWT.NONE ); time.setLayout( new FillLayout() ); wHour = new Spinner( time, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); wHour.setMinimum( 0 ); props.setDialogSize( shell, "JobSpecialDialogSize" ); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep();
@Override protected void createContents() { shell.setText(RedisClient.i18nFile.getText(I18nFile.OPTIONS)); shell.setLayout(new GridLayout(1, false)); Composite composite_1 = new Composite(shell, SWT.NONE); composite_1.setLayout(new FillLayout(SWT.HORIZONTAL)); composite_1.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
@Override protected JavaGraphics createGraphics (Config config) { Display.setAppName(config.appName); display = new Display(); shell = new Shell(display); shell.setLayout(new FillLayout()); shell.addShellListener(new ShellAdapter() { public void shellActivated (ShellEvent e) { onResume(); } public void shellDeactivated (ShellEvent e) { onPause(); } }); comp = new Composite(shell, SWT.NONE); comp.setLayout(null); return new SWTGraphics(this, config, comp); }
public Composite getComposite( Composite parent, ImportRuleInterface importRule ) { PropsUI props = PropsUI.getInstance(); composite = new Composite( parent, SWT.NONE ); props.setLook( composite ); composite.setLayout( new FillLayout() ); Label label = new Label( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT ); props.setLook( label ); label.setText( "Minimum length: " ); text = new Text( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT ); props.setLook( text ); return composite; }
/** * Invokes as a standalone program. */ public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText(getResourceString("window.title")); shell.setLayout(new GridLayout()); PaintExample instance = new PaintExample(shell); instance.createToolBar(shell); Composite composite = new Composite(shell, SWT.NONE); composite.setLayout(new FillLayout()); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); instance.createGUI(composite); instance.setDefaults(); setShellSize(display, shell); shell.open(); while (! shell.isDisposed()) { if (! display.readAndDispatch()) display.sleep(); } instance.dispose(); }
protected void initContents() { Composite composite_1 = new Composite(shell, SWT.NONE); composite_1.setLayout(new FillLayout(SWT.HORIZONTAL)); composite_1.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); btnOk = new Button(composite_1, SWT.NONE); btnOk.addSelectionListener(okSelection); btnOk.setText(RedisClient.i18nFile.getText(I18nFile.OK)); Button btnCancel = new Button(composite_1, SWT.NONE); btnCancel.addSelectionListener(cancelSelection); btnCancel.setText(RedisClient.i18nFile.getText(I18nFile.CANCEL)); }
shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN ); formLayout.marginWidth = 5; formLayout.marginHeight = 5; shell.setLayout( formLayout ); Composite buttonsComposite = new Composite( shell, SWT.NONE ); FillLayout bcLayout = new FillLayout(); bcLayout.spacing = 5; buttonsComposite.setLayout( bcLayout ); ok = new Button( buttonsComposite, SWT.PUSH ); ok.setText( " OK " ); // TODO i18n sashForm.setLayout( new FillLayout() ); fdBC.left = new FormAttachment( sashForm, 0, SWT.CENTER ); fdBC.bottom = new FormAttachment( 100, 0 ); buttonsComposite.setLayoutData( fdBC ); red = new Color( shell.getDisplay(), 255, 0, 0 ); green = new Color( shell.getDisplay(), 0, 220, 0 ); blue = new Color( shell.getDisplay(), 0, 0, 255 );
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); Composite c = new Composite(shell, SWT.NONE); c.setLayoutData(new GridData()); // default values so it doesn't grab excess space c.setLayout(new FillLayout()); Button myCheckbox = new Button(c, SWT.CHECK); myCheckbox.setText("Checkbox text"); myCheckbox.setToolTipText("Tooltip message"); myCheckbox.setEnabled(false); // assign the same tooltip to the encapsulating composite myCheckbox.getParent().setToolTipText(myCheckbox.getToolTipText()); shell.setSize(200, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
Display display = new Display(); Shell shell = new Shell(); shell.setLayout(new FillLayout()); content.setLayout(new GridLayout(3, true)); button.setText(data); button.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); shell.pack(); shell.open(); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep();
rowLayout.wrap = true; Display display = new Display(); shell.setLayout(new FillLayout()); shell.setMinimumSize(1, 1); composite.setLayout(rowLayout); shell.pack(); shell.open(); shell.setSize(50, 200); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep();
composite.addListener(SWT.Resize, new Listener() { public void handleEvent(Event e) { changeImage(); composite.setLayout(new FormLayout()); composite.setBackgroundMode(SWT.INHERIT_DEFAULT); Shell shell = new Shell(display); try { shell.setSize(200, 100); shell.setLayout(new FillLayout()); createComponents(shell); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) {
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(); }
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"); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { 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"); closeButton.addSelectionListener(new SelectionAdapter() { @Override
public Composite getComposite( Composite parent, ImportRuleInterface importRule ) { composite = new Composite( parent, SWT.NONE ); PropsUI.getInstance().setLook( composite ); composite.setLayout( new FillLayout() ); return composite; }
Display display = new Display(); final Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new FillLayout()); spinner.addListener(SWT.Verify, new Listener() shell.pack(); shell.setSize(100, shell.computeSize(SWT.DEFAULT, SWT.DEFAULT).y); shell.open();