summaryrefslogtreecommitdiff
path: root/java/EAC/Configurator.java
blob: 1a9bc7a0ed868d563f9eedcb0bba459f6c15f70d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
 *  Title:        Configurator
 *  Description:  The application class for the Event Analysis Configurator
 */
package EAC;
import java.awt.*;
import java.awt.event.*;

public class Configurator extends Frame {

  // Initial dimensions of the frame
  public final int INITIAL_WIDTH = 800;
  public final int INITIAL_HEIGHT = 600;

  protected TextField inputArea = new TextField("Input Area", 80);
  protected Label reportArea = new Label();
  protected Configuration config = new Configuration(inputArea,reportArea);
  protected EACPanel canvas = new EACPanel(config,inputArea,reportArea);
  protected EACMenuBar menuBar = new EACMenuBar(canvas,config,inputArea,reportArea);

  Configurator(int tick) {
    config.setTick(tick);

    setTitle("The Event Analysis Configurator");
    setLayout(new BorderLayout());
    reportArea.setText("Report Area");

    // Input Area at top of frame
    add(inputArea,"North");

    // Report Area at bottom of frame
    add(reportArea,"South");

    // Canvas in the middle of frame
    add(canvas,"Center");

    // Menu Bar
    setMenuBar(menuBar);

    // Move and resize
    setLocation(0,0);
    setSize(INITIAL_WIDTH,INITIAL_HEIGHT);

    // For exiting
    addWindowListener(new Closer());
  }

  public static void main (String[] argv) {
    new Configurator(java.lang.Integer.valueOf(argv[0]).intValue()).show();
  }

  class Closer extends WindowAdapter {
    public void windowClosing (WindowEvent e) {
	System.exit (0);
    }
  }

} /* Configurator */