How to dispose ApplicationWindow [message #520027] |
Wed, 10 March 2010 16:20  |
Eclipse User |
|
|
|
Hi all,
maybe this is a beginner question, but this is a hobby project of mine.
I have problems terminating my programm cleanly. Below is my code. So
when I close the window the task will not be treminated completely (no
Finished! writing in the console). What I am missing here to terminate
the applicationwindow? I tried it even without any content created ...
thanks
Ilja
public class AVC extends ApplicationWindow {
private AVC(Shell shell) {
super(shell);
}
protected Control createContents (Composite parent) {
getShell().setText ("Das namenlose Programm");
getShell().setSize(1000, 700);
return new Composite (parent, SWT.BORDER | SWT.NULL);
}
public static void main(String[] args) {
final Display display = new Display();
Realm.runWithDefault(SWTObservables.getRealm(display), new Runnable() {
public void run() {
Shell shell = new Shell(display);
AVC avc = new AVC(shell);
avc.setBlockOnOpen (true);
avc.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
avc.handleShellCloseEvent();
}
});
display.dispose();
System.out.println("Finished!");
}
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.03190 seconds