Example #1
0
 private Frame getFrame() {
   if (frame != null) return frame;
   frame = new JFrame();
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
   frame.setLocation(
       (dim.width - viewSize.getRealWidth()) / 2, (dim.height - viewSize.getRealHeight()) / 2);
   frame.add(getPanel());
   frame.pack();
   return frame;
 }
Example #2
0
 private Panel getPanel() {
   if (panel != null) return panel;
   panel = new Panel(viewSize);
   panel.setPreferredSize(viewSize.getDimension());
   return panel;
 }