View Javadoc
1   package org.woehlke.simulation.cyclic.cellular.automaton.view;
2   
3   import javax.accessibility.Accessible;
4   import javax.swing.*;
5   import java.awt.*;
6   import java.awt.event.WindowEvent;
7   import java.awt.event.WindowListener;
8   import java.awt.image.ImageObserver;
9   import java.io.Serializable;
10  
11  /**
12   * (C) 2006 - 2013 Thomas Woehlke.
13   * http://thomas-woehlke.de/p/cyclic-cellular-automaton/
14   * @author Thomas Woehlke
15   * Date: 04.02.2006
16   * Time: 18:47:46
17   */
18  public class AppMainFrame extends JFrame implements ImageObserver,
19          MenuContainer,
20          Serializable,
21          Accessible,
22          WindowListener {
23  
24      private CyclicCellularAutomatonApplet exe;
25  
26      public AppMainFrame() {
27          super("cyclic cellular automaton");
28          exe = new CyclicCellularAutomatonApplet();
29          exe.init();
30          add("Center", exe);
31          setBounds(100, 100, exe.getCanvasDimensions().getX(), exe.getCanvasDimensions().getY() + 30);
32          pack();
33          setVisible(true);
34          toFront();
35          addWindowListener(this);
36      }
37  
38      public void windowOpened(WindowEvent e) {
39          setBounds(100, 100, exe.getCanvasDimensions().getX(), exe.getCanvasDimensions().getY() + 30);
40          setVisible(true);
41          toFront();
42      }
43  
44      public void windowClosing(WindowEvent e) {
45          System.exit(0);
46      }
47  
48      public void windowClosed(WindowEvent e) {
49          System.exit(0);
50      }
51  
52      public void windowIconified(WindowEvent e) {
53  
54      }
55  
56      public void windowDeiconified(WindowEvent e) {
57          setBounds(100, 100, exe.getCanvasDimensions().getX(), exe.getCanvasDimensions().getY() + 30);
58          setVisible(true);
59          toFront();
60      }
61  
62      public void windowActivated(WindowEvent e) {
63          toFront();
64      }
65  
66      public void windowDeactivated(WindowEvent e) {
67      }
68  }