public static void main(java.lang.String[] args) { org.eclipse.swt.widgets.Display display = new org.eclipse.swt.widgets.Display(); org.eclipse.swt.widgets.Shell shell = new org.eclipse.swt.widgets.Shell(display); shell.setLayout(new org.eclipse.swt.layout.FillLayout()); shell.setText(getResourceString("window.title")); java.io.InputStream stream = (org.eclipse.swt.examples.browserexample.BrowserExample.class) .getResourceAsStream(iconLocation); org.eclipse.swt.graphics.Image icon = new org.eclipse.swt.graphics.Image(display, stream); shell.setImage(icon); try { stream.close(); } catch (java.io.IOException e) { e.printStackTrace(); } org.eclipse.swt.examples.browserexample.BrowserExample app = new org.eclipse.swt.examples.browserexample.BrowserExample(shell, true); app.setShellDecoration(icon, true); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } icon.dispose(); app.dispose(); display.dispose(); }
void createShell(org.eclipse.swt.widgets.Display display) { shell = new org.eclipse.swt.widgets.Shell(display); shell.setText(resources.getString("Window_title")); org.eclipse.swt.layout.GridLayout layout = new org.eclipse.swt.layout.GridLayout(); layout.numColumns = 1; shell.setLayout(layout); shell.addShellListener( new org.eclipse.swt.events.ShellAdapter() { public void shellClosed(org.eclipse.swt.events.ShellEvent e) { lineStyler.disposeColors(); text.removeLineStyleListener(lineStyler); } }); }
public ToolTipHandler(org.eclipse.swt.widgets.Shell parent) { final org.eclipse.swt.widgets.Display display = parent.getDisplay(); this.parentShell = parent; tipShell = new org.eclipse.swt.widgets.Shell(parent, SWT.ON_TOP | SWT.TOOL); org.eclipse.swt.layout.GridLayout gridLayout = new org.eclipse.swt.layout.GridLayout(); gridLayout.numColumns = 2; gridLayout.marginWidth = 2; gridLayout.marginHeight = 2; tipShell.setLayout(gridLayout); tipShell.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); tipLabelImage = new org.eclipse.swt.widgets.Label(tipShell, SWT.NONE); tipLabelImage.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); tipLabelImage.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); tipLabelImage.setLayoutData( new org.eclipse.swt.layout.GridData( GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER)); tipLabelText = new org.eclipse.swt.widgets.Label(tipShell, SWT.NONE); tipLabelText.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); tipLabelText.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); tipLabelText.setLayoutData( new org.eclipse.swt.layout.GridData( (-(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER)))); }
public static void main(java.lang.String[] args) { org.eclipse.swt.widgets.Display display = new org.eclipse.swt.widgets.Display(); org.eclipse.swt.widgets.Shell shell = new org.eclipse.swt.widgets.Shell(display); shell.setText(getResourceString("window.title")); shell.setLayout(new org.eclipse.swt.layout.GridLayout()); org.eclipse.swt.examples.paint.PaintExample instance = new org.eclipse.swt.examples.paint.PaintExample(shell); instance.createToolBar(shell); org.eclipse.swt.widgets.Composite composite = new org.eclipse.swt.widgets.Composite(shell, SWT.NONE); composite.setLayout(new org.eclipse.swt.layout.FillLayout()); composite.setLayoutData(new org.eclipse.swt.layout.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(); }