Skip to content

Instantly share code, notes, and snippets.

@yinyin
Created September 12, 2015 04:56
Show Gist options
  • Save yinyin/76da13abc32ba13890e5 to your computer and use it in GitHub Desktop.
Save yinyin/76da13abc32ba13890e5 to your computer and use it in GitHub Desktop.
Template code generated with WindowBuilder's SWT > ApplicationWindow
package local.dev;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class TestWindow {
protected Shell shell;
/**
* Launch the application.
* @param args
*/
public static void main(String[] args) {
try {
TestWindow window = new TestWindow();
window.open();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Open the window.
*/
public void open() {
Display display = Display.getDefault();
createContents();
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
/**
* Create contents of the window.
*/
protected void createContents() {
shell = new Shell();
shell.setSize(450, 300);
shell.setText("SWT Application");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment