Created
September 12, 2015 04:56
-
-
Save yinyin/76da13abc32ba13890e5 to your computer and use it in GitHub Desktop.
Template code generated with WindowBuilder's SWT > ApplicationWindow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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