KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > tools > mapping > reversedb2 > gui > JFrmMain


1 /* Copyright 2002-2005 The Apache Software Foundation
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */

15
16 package org.apache.ojb.tools.mapping.reversedb2.gui;
17 import org.apache.ojb.tools.mapping.reversedb2.actions.*;
18 import org.apache.ojb.tools.mapping.reversedb2.Main;
19
20 /**
21  *
22  * @author Administrator
23  */

24 public class JFrmMain extends javax.swing.JFrame JavaDoc {
25     
26     /** Creates new form JFrmMain */
27     public JFrmMain()
28     {
29         initComponents();
30         try
31         {
32             int width = Integer.parseInt(
33                 Main.getProperties().getProperty(Main.PROPERTY_MAINFRAME_WIDTH, "640"));
34             int height = Integer.parseInt(
35                 Main.getProperties().getProperty(Main.PROPERTY_MAINFRAME_HEIGHT, "480"));
36             int posx = Integer.parseInt(
37                 Main.getProperties().getProperty(Main.PROPERTY_MAINFRAME_POSX, "0"));
38             int posy = Integer.parseInt(
39                 Main.getProperties().getProperty(Main.PROPERTY_MAINFRAME_POSY, "0"));
40             this.setBounds(posx, posy, width, height);
41         }
42         catch (Throwable JavaDoc t)
43         {
44             // Ignore this exceptions
45
}
46         
47         this.fileMenu.add(new ActionOpenDatabase(this));
48         this.fileMenu.add(new ActionOpenOJBRepository(this));
49         this.fileMenu.add(new ActionNewOJBRepository(this));
50         
51         
52         
53         this.setContentPane(new javax.swing.JDesktopPane JavaDoc());
54     }
55     
56    
57     /** This method is called from within the constructor to
58      * initialize the form.
59      * WARNING: Do NOT modify this code. The content of this method is
60      * always regenerated by the Form Editor.
61      */

62     private void initComponents()//GEN-BEGIN:initComponents
63
{
64         menuBar = new javax.swing.JMenuBar JavaDoc();
65         fileMenu = new javax.swing.JMenu JavaDoc();
66         exitMenuItem = new javax.swing.JMenuItem JavaDoc();
67         editMenu = new javax.swing.JMenu JavaDoc();
68         cutMenuItem = new javax.swing.JMenuItem JavaDoc();
69         copyMenuItem = new javax.swing.JMenuItem JavaDoc();
70         pasteMenuItem = new javax.swing.JMenuItem JavaDoc();
71         deleteMenuItem = new javax.swing.JMenuItem JavaDoc();
72         helpMenu = new javax.swing.JMenu JavaDoc();
73         contentMenuItem = new javax.swing.JMenuItem JavaDoc();
74         aboutMenuItem = new javax.swing.JMenuItem JavaDoc();
75
76         setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
77         addWindowListener(new java.awt.event.WindowAdapter JavaDoc()
78         {
79             public void windowClosing(java.awt.event.WindowEvent JavaDoc evt)
80             {
81                 exitForm(evt);
82             }
83         });
84
85         fileMenu.setText("File");
86         fileMenu.addActionListener(new java.awt.event.ActionListener JavaDoc()
87         {
88             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
89             {
90                 fileMenuActionPerformed(evt);
91             }
92         });
93
94         exitMenuItem.setText("Exit");
95         exitMenuItem.addActionListener(new java.awt.event.ActionListener JavaDoc()
96         {
97             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
98             {
99                 exitMenuItemActionPerformed(evt);
100             }
101         });
102
103         fileMenu.add(exitMenuItem);
104
105         menuBar.add(fileMenu);
106
107         editMenu.setText("Edit");
108         cutMenuItem.setText("Cut");
109         editMenu.add(cutMenuItem);
110
111         copyMenuItem.setText("Copy");
112         editMenu.add(copyMenuItem);
113
114         pasteMenuItem.setText("Paste");
115         editMenu.add(pasteMenuItem);
116
117         deleteMenuItem.setText("Delete");
118         editMenu.add(deleteMenuItem);
119
120         menuBar.add(editMenu);
121
122         helpMenu.setText("Help");
123         contentMenuItem.setText("Contents");
124         helpMenu.add(contentMenuItem);
125
126         aboutMenuItem.setText("About");
127         helpMenu.add(aboutMenuItem);
128
129         menuBar.add(helpMenu);
130
131         setJMenuBar(menuBar);
132
133         pack();
134     }//GEN-END:initComponents
135

136     private void fileMenuActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_fileMenuActionPerformed
137
{//GEN-HEADEREND:event_fileMenuActionPerformed
138

139     }//GEN-LAST:event_fileMenuActionPerformed
140

141     private void exitMenuItemActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
142
System.exit(0);
143     }//GEN-LAST:event_exitMenuItemActionPerformed
144

145     /** Exit the Application */
146     private void exitForm(java.awt.event.WindowEvent JavaDoc evt) {//GEN-FIRST:event_exitForm
147
Main.getProperties().setProperty(Main.PROPERTY_MAINFRAME_HEIGHT, "" + this.getHeight());
148         Main.getProperties().setProperty(Main.PROPERTY_MAINFRAME_WIDTH, "" + this.getWidth());
149         Main.getProperties().setProperty(Main.PROPERTY_MAINFRAME_POSX, "" + this.getBounds().x);
150         Main.getProperties().setProperty(Main.PROPERTY_MAINFRAME_POSY, "" + this.getBounds().y);
151         Main.getProperties().storeProperties("");
152         System.exit(0);
153     }//GEN-LAST:event_exitForm
154

155     /**
156      * @param args the command line arguments
157      */

158     public static void main(String JavaDoc args[]) {
159         new JFrmMain().show();
160     }
161     
162     // Variables declaration - do not modify//GEN-BEGIN:variables
163
private javax.swing.JMenu JavaDoc fileMenu;
164     private javax.swing.JMenuItem JavaDoc contentMenuItem;
165     private javax.swing.JMenuItem JavaDoc exitMenuItem;
166     private javax.swing.JMenuItem JavaDoc copyMenuItem;
167     private javax.swing.JMenuItem JavaDoc pasteMenuItem;
168     private javax.swing.JMenuItem JavaDoc cutMenuItem;
169     private javax.swing.JMenuBar JavaDoc menuBar;
170     private javax.swing.JMenu JavaDoc editMenu;
171     private javax.swing.JMenuItem JavaDoc aboutMenuItem;
172     private javax.swing.JMenu JavaDoc helpMenu;
173     private javax.swing.JMenuItem JavaDoc deleteMenuItem;
174     // End of variables declaration//GEN-END:variables
175

176 }
177
Popular Tags