void createStyledText() { text = new org.eclipse.swt.custom.StyledText( shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); org.eclipse.swt.layout.GridData spec = new org.eclipse.swt.layout.GridData(); spec.horizontalAlignment = GridData.FILL; spec.grabExcessHorizontalSpace = true; spec.verticalAlignment = GridData.FILL; spec.grabExcessVerticalSpace = true; text.setLayoutData(spec); text.addLineStyleListener(lineStyler); text.setEditable(false); org.eclipse.swt.graphics.Color bg = Display.getDefault().getSystemColor(SWT.COLOR_GRAY); text.setBackground(bg); }
public static void main(String[] args) { Display display = Display.getDefault(); Shell shell = new Shell(display); @SuppressWarnings("unused") MainWindow inst = new MainWindow(shell, SWT.NULL); shell.setLayout(new FillLayout()); shell.setImage(SWTResourceManager.getImage("images/16x16.png")); shell.setText("Change This Title"); shell.setBackgroundImage(SWTResourceManager.getImage("images/ToolbarBackground.gif")); shell.layout(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }
public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(InstallOptionsModel.PROPERTY_INDEX)) { mDialog.moveChild(mCurrentWidget, ((Integer) evt.getNewValue()).intValue()); } else if (evt.getPropertyName().equals(InstallOptionsModel.PROPERTY_CHILDREN)) { if (Common.objectsAreEqual(mCurrentWidget, evt.getOldValue()) && evt.getNewValue() instanceof InstallOptionsWidget) { InstallOptionsWidget widget = (InstallOptionsWidget) evt.getNewValue(); mCurrentWidget.removeModelCommandListener(InstallOptionsWidgetEditorDialog.this); mCurrentWidget.removePropertyChangeListener(InstallOptionsWidgetEditorDialog.this); mCurrentWidget = widget; mSection = mCurrentWidget.getSection(); mCurrentWidget.addModelCommandListener(InstallOptionsWidgetEditorDialog.this); mCurrentWidget.addPropertyChangeListener(InstallOptionsWidgetEditorDialog.this); Display.getDefault() .asyncExec( new Runnable() { public void run() { mPage.selectionChanged(null, new StructuredSelection(mCurrentWidget)); } }); } } }