A typical SWT sample code looks like the following code:
final Display display = Display.getDefault();
final Shell shell = createMyShell(display);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
What is the difference between Display
and Shell
?
If multiple windows have to be shown, does each one need an own loop?
You can have multiple shells with a single Display and a single while loop handing event dispatch. Create the display, create the Shell(s) from the Display, and then start the single UI event dispatcher loop. See http://www.chrisnewland.com/av/111/swt-best-practice-single-display-multiple-shells
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With