OnJava8-Examples/swt/ShellsAreMainWindows.java
Bruce Eckel 88dbdbbbcb update
2015-05-18 23:05:30 -07:00

27 lines
662 B
Java

//: swt/ShellsAreMainWindows.java
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;
}
} ///:~