OnJava8-Examples/swt/ShellsAreMainWindows.java
2015-11-15 15:51:35 -08:00

30 lines
833 B
Java

// swt/ShellsAreMainWindows.java
// ©2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
import org.eclipse.swt.widgets.*;
public class ShellsAreMainWindows {
static Shell[] shells = new Shell[10];
public static void main(String [] args) {
Display display = new Display();
for(int i = 0; i < shells.length; i++) {
shells[i] = new Shell(display);
shells[i].setText("Shell #" + i);
shells[i].open();
}
while(!shellsDisposed())
if(!display.readAndDispatch())
display.sleep();
display.dispose();
}
static boolean shellsDisposed() {
for(Shell shell : shells) {
if(shell.isDisposed()) {
return true;
}
}
return false;
}
}