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(); }
public static void main( String[] args ) { Display display = new Display(); LogChannelInterface log = new LogChannel( APP_NAME ); PropsUI.init( display, Props.TYPE_PROPERTIES_SPOON ); Translator translator = new Translator( display ); translator.open(); try { while ( !display.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } } catch ( Throwable e ) { log.logError( "An unexpected error occurred : " + e.getMessage() ); log.logError( Const.getStackTracker( e ) ); } }
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"); 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"); dialogShell.open(); shell.open(); return shell;
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 ) throws Exception { if ( args.length != 2 ) { System.err.println( "Usage: Translator <translator.xml> <path-to-source>" ); System.err.println( "Example:" ); System.err.println( "sh translator.sh translator.xml ." ); System.exit( 1 ); } KettleClientEnvironment.init(); String configFile = args[0]; String sourceFolder = args[1]; Display display = new Display(); LogChannelInterface log = new LogChannel( APP_NAME ); PropsUI.init( display, Props.TYPE_PROPERTIES_SPOON ); Translator2 translator = new Translator2( display ); translator.loadConfiguration( configFile, sourceFolder ); translator.open(); try { while ( !display.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } } catch ( Throwable e ) { log.logError( BaseMessages.getString( PKG, "i18n.UnexpectedError", e.getMessage() ) ); log.logError( Const.getStackTracker( e ) ); } }
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.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 ();
public static void main( String[] args ) { Display display = new Display( ); try { KettleEnvironment.init(); PropsUI.init( display, Props.TYPE_PROPERTIES_SPOON ); KettleLogStore .init( PropsUI.getInstance().getMaxNrLinesInLog(), PropsUI.getInstance().getMaxLogLineTimeoutMinutes() ); } catch ( KettleException e ) { e.printStackTrace(); } KettleClientEnvironment.getInstance().setClient( KettleClientEnvironment.ClientType.SPOON ); Shell shell = new Shell( display, SWT.DIALOG_TRIM ); shell.open(); CapabilityManagerDialog capabilityManagerDialog = new CapabilityManagerDialog( shell ); capabilityManagerDialog.open(); while ( !shell.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } }
public static void main(String[] args) { Display d = new Display(); final Shell shell = new Shell(d); shell.setLayout(new GridLayout(1, false)); Text text = new Text(shell, SWT.BORDER); text.setText("Some random text here..."); text.setSelection(text.getText().length()); shell.pack(); shell.open(); while (!shell.isDisposed()) while (!d.readAndDispatch()) d.sleep(); }
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();
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();
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(); }
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(); }