public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.open(); DirectoryDialog dialog = new DirectoryDialog(shell); dialog.setFilterPath("c:\\"); // Windows specific System.out.println("RESULT=" + dialog.open()); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); display.dispose();
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(); }
/** * Open the window. * */ public void open() { Display display = null; display = Display.getDefault(); createContents(); shell.open(); shell.layout(); while (!shell.isDisposed()) { try { if (!display.readAndDispatch()) { display.sleep(); } } catch (Exception e) { MessageDialog.openError(shell, i18nFile.getText(I18nFile.ERROR), e.getLocalizedMessage()); e.printStackTrace(); } } display.dispose(); }
Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); shell.setText("Hide Label"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); display.dispose();
import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; public class SWTFileOpenSnippet { public static void main (String [] args) { Display display = new Display (); Shell shell = new Shell (display); // Don't show the shell. //shell.open (); FileDialog dialog = new FileDialog (shell, SWT.OPEN | SWT.MULTI); String [] filterNames = new String [] {"All Files (*)"}; String [] filterExtensions = new String [] {"*"}; String filterPath = "c:\\"; dialog.setFilterNames (filterNames); dialog.setFilterExtensions (filterExtensions); dialog.setFilterPath (filterPath); dialog.open(); System.out.println ("Selected files: "); String[] selectedFileNames = dialog.getFileNames(); for(String fileName : selectedFileNames) { System.out.println(" " + fileName); } shell.close(); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } }
Display display = new Display (); shell.open (); while (!shell.isDisposed()) { if (!display.readAndDispatch ()) display.sleep (); display.dispose ();
Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); Label label = new Label(shell, SWT.NONE); label.setText("I am italic"); FontData fontData = label.getFont().getFontData()[0]; Font font = new Font(display, new FontData(fontData.getName(), fontData .getHeight(), SWT.ITALIC)); label.setFont(font); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } font.dispose(); display.dispose();
Display display = new Display(); final Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new GridLayout(1, true)); shell.open(); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); display.dispose();
Display display = new Display(); Shell shell = new Shell(display); RowLayout layout = new RowLayout(SWT.VERTICAL); layout.fill = true; shell.setLayout(layout); shell.setSize(200, 200); final Table table = new Table(shell, SWT.BORDER | SWT.MULTI); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); display.dispose();
final Shell shell = new Shell(display); shell.setText("StackOverflow"); shell.setLayout(new FillLayout()); shell.open(); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); display.dispose();
Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new RowLayout(SWT.VERTICAL)); final ToolTip tip = new ToolTip(shell, SWT.BALLOON); tip.setMessage("Here is a message for the user. When the message is too long it wraps. I should say something cool but nothing comes to my mind."); tfNext.setText("TF without tooltip"); shell.setBounds(50, 50, 300, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); display.dispose();
Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); shell.open(); while(!shell.isDisposed()) if(!display.readAndDispatch()) display.sleep(); display.dispose();
Display display = new Display(); Shell shell = new Shell(display); // Define message box shell.open(); while (!shell.isDisposed()) { if (display.readAndDispatch()) { display.sleep(); } } display.dispose();
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class FirstSWTApplication { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); final int style = OS.GetWindowLong(shell.handle, OS.GWL_STYLE); OS.SetWindowLong(shell.handle, OS.GWL_STYLE, style & ~0x00040000); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
public void run() { d = new Display(); while (runEventLoop) { if (!d.readAndDispatch()) { d.sleep(); } } d.dispose(); } public Display getDisplay() {
private void readAndDispatch( Display display, Shell shell ) { while( !shell.isDisposed() ) { if( !display.readAndDispatch() ) { display.sleep(); } } display.dispose(); }
import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; public class ReadOnlyTextExample { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); // Create a read-only text field new Text(shell, SWT.READ_ONLY | SWT.BORDER).setText("Read Only"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } }