9 public static void center(Window w) {
10 Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
11 Dimension window = w.getSize();
14 int left = screen.width/2-window.width/2;
15 int top = (screen.height-window.height)/4;
17 w.setLocation(left, top);
22 static private Frame frame;
26 if (width==0 || height==0)
27 throw new IllegalArgumentException(
"");
31 frame.setBackground(Color.white);
33 Image img = frame.createImage(width, height);