Exemplo n.º 1
0
 @Override
 public void init() {
   AdvancedGUIEX1 content = new AdvancedGUIEX1();
   content.setBorder(BorderFactory.createLineBorder(Color.GRAY, 2));
   setContentPane(content);
   setJMenuBar(content.getMenuBar());
 }
Exemplo n.º 2
0
 /** The main routine simply opens a window that shows a PaintWithOffScreenCanvas panel. */
 public static void main(String[] args) {
   JFrame window = new JFrame("PaintWithOffScreenCanvas");
   AdvancedGUIEX1 content = new AdvancedGUIEX1();
   window.setContentPane(content);
   window.setJMenuBar(content.getMenuBar());
   window.pack();
   window.setResizable(false);
   Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
   window.setLocation(
       (screenSize.width - window.getWidth()) / 2, (screenSize.height - window.getHeight()) / 2);
   window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   window.setVisible(true);
 }