KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > core > monitor > StorageFrame


1 //$Id: StorageFrame.java,v 1.3 2002/08/27 08:32:26 per_nyfelt Exp $
2

3 package org.ozoneDB.core.monitor;
4
5 import org.ozoneDB.DxLib.*;
6 import org.ozoneDB.core.Env;
7
8 import java.awt.*;
9 import java.awt.event.*;
10 import java.util.*;
11 import java.io.*;
12
13
14 /**
15  *.
16  * @author softwarebuero m&b
17  * @version $Id: StorageFrame.java,v 1.3 2002/08/27 08:32:26 per_nyfelt Exp $
18  */

19 public class StorageFrame extends Frame {
20     protected Env env;
21
22
23     /** */
24     class MenuListener implements ActionListener {
25
26
27         public void actionPerformed( ActionEvent evt ) {
28             String JavaDoc cmd = evt.getActionCommand();
29             if (cmd.equals( "STOP" )) {
30                 env.shutdown();
31             }
32         }
33     }
34
35
36     /** */
37     class ButtonListener implements ActionListener {
38
39
40         public void actionPerformed( ActionEvent evt ) {
41             Object JavaDoc source = evt.getSource();
42             if (source.equals( closeButton )) {
43                 exitForm();
44             }
45         }
46     }
47
48     /** diverse oberflaechen-elemente */
49     private Panel mainPanel;
50     private Button closeButton;
51     private StorageCanvas storageCanvas;
52     private TransactionCanvas transactionCanvas;
53
54
55     /** Initializes the Form */
56     public StorageFrame( Env _env ) {
57         env = _env;
58         setTitle( "OZONOMETER" );
59         setLocation( 10, 10 );
60         setSize( 700, 500 );
61
62         addWindowListener( new WindowAdapter() {
63
64
65             public void windowClosing( WindowEvent evt ) {
66                 exitForm();
67             }
68         } );
69
70         Dimension dim = getSize();
71         int menuH = 55;
72         int buttonHeight = 30;
73         int panelH = 50;
74
75         setFont( new Font( "Helvetica", Font.PLAIN, 12 ) );
76         setBackground( new Color( 200, 200, 210 ) );
77         setMenuBar( new StorageMenubar( new MenuListener() ) );
78
79         setLayout( new AbsoluteLayout() );
80         transactionCanvas = new TransactionCanvas();
81         storageCanvas = new StorageCanvas();
82         add( transactionCanvas, new AbsoluteConstraints( 10, menuH + 10, dim.width / 2 - 10,
83                 dim.height - menuH - 20 - panelH, AbsoluteConstraints.X2_PROP | AbsoluteConstraints.Y2_ABS ) );
84         add( storageCanvas, new AbsoluteConstraints( dim.width / 2 + 5, menuH + 10, dim.width / 2 - 15,
85                 dim.height - menuH - 20 - panelH, AbsoluteConstraints.RESIZE_ABS | AbsoluteConstraints.X_PROP ) );
86
87         ButtonListener buttonListener = new ButtonListener();
88         mainPanel = new Panel();
89         mainPanel.setLayout( new AbsoluteLayout() );
90         add( mainPanel, new AbsoluteConstraints( 10, dim.height - panelH - 5, dim.width - 20, panelH - 5,
91                 AbsoluteConstraints.Y_ABS | AbsoluteConstraints.Y2_ABS | AbsoluteConstraints.X2_ABS ) );
92         // mainPanel.setBackground (StorageCanvas.bgColor);
93
Dimension pd = mainPanel.getSize();
94         closeButton = new Button( "Close" );
95         closeButton.addActionListener( buttonListener );
96         mainPanel.add( closeButton, new AbsoluteConstraints( 680 - 65 - 5, 10, 65, 30, AbsoluteConstraints.MOVE_ABS ) );
97     }
98
99
100     /** */
101     public void updateView() {
102         storageCanvas.repaint();
103         transactionCanvas.repaint();
104     }
105
106
107     /** */
108     public void exitForm() {
109         setVisible( false );
110         dispose();
111         //env.storageFrame = null;
112
}
113 }
114
Popular Tags