001: /* Copyright 2002-2005 The Apache Software Foundation
002: *
003: * Licensed under the Apache License, Version 2.0 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at
006: *
007: * http://www.apache.org/licenses/LICENSE-2.0
008: *
009: * Unless required by applicable law or agreed to in writing, software
010: * distributed under the License is distributed on an "AS IS" BASIS,
011: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012: * See the License for the specific language governing permissions and
013: * limitations under the License.
014: */
015:
016: package org.apache.ojb.tools.mapping.reversedb2.gui;
017:
018: import org.apache.ojb.tools.mapping.reversedb2.actions.*;
019: import org.apache.ojb.tools.mapping.reversedb2.Main;
020:
021: /**
022: *
023: * @author Administrator
024: */
025: public class JFrmMain extends javax.swing.JFrame {
026:
027: /** Creates new form JFrmMain */
028: public JFrmMain() {
029: initComponents();
030: try {
031: int width = Integer.parseInt(Main.getProperties()
032: .getProperty(Main.PROPERTY_MAINFRAME_WIDTH, "640"));
033: int height = Integer
034: .parseInt(Main.getProperties().getProperty(
035: Main.PROPERTY_MAINFRAME_HEIGHT, "480"));
036: int posx = Integer.parseInt(Main.getProperties()
037: .getProperty(Main.PROPERTY_MAINFRAME_POSX, "0"));
038: int posy = Integer.parseInt(Main.getProperties()
039: .getProperty(Main.PROPERTY_MAINFRAME_POSY, "0"));
040: this .setBounds(posx, posy, width, height);
041: } catch (Throwable t) {
042: // Ignore this exceptions
043: }
044:
045: this .fileMenu.add(new ActionOpenDatabase(this ));
046: this .fileMenu.add(new ActionOpenOJBRepository(this ));
047: this .fileMenu.add(new ActionNewOJBRepository(this ));
048:
049: this .setContentPane(new javax.swing.JDesktopPane());
050: }
051:
052: /** This method is called from within the constructor to
053: * initialize the form.
054: * WARNING: Do NOT modify this code. The content of this method is
055: * always regenerated by the Form Editor.
056: */
057: private void initComponents()//GEN-BEGIN:initComponents
058: {
059: menuBar = new javax.swing.JMenuBar();
060: fileMenu = new javax.swing.JMenu();
061: exitMenuItem = new javax.swing.JMenuItem();
062: editMenu = new javax.swing.JMenu();
063: cutMenuItem = new javax.swing.JMenuItem();
064: copyMenuItem = new javax.swing.JMenuItem();
065: pasteMenuItem = new javax.swing.JMenuItem();
066: deleteMenuItem = new javax.swing.JMenuItem();
067: helpMenu = new javax.swing.JMenu();
068: contentMenuItem = new javax.swing.JMenuItem();
069: aboutMenuItem = new javax.swing.JMenuItem();
070:
071: setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
072: addWindowListener(new java.awt.event.WindowAdapter() {
073: public void windowClosing(java.awt.event.WindowEvent evt) {
074: exitForm(evt);
075: }
076: });
077:
078: fileMenu.setText("File");
079: fileMenu.addActionListener(new java.awt.event.ActionListener() {
080: public void actionPerformed(java.awt.event.ActionEvent evt) {
081: fileMenuActionPerformed(evt);
082: }
083: });
084:
085: exitMenuItem.setText("Exit");
086: exitMenuItem
087: .addActionListener(new java.awt.event.ActionListener() {
088: public void actionPerformed(
089: java.awt.event.ActionEvent evt) {
090: exitMenuItemActionPerformed(evt);
091: }
092: });
093:
094: fileMenu.add(exitMenuItem);
095:
096: menuBar.add(fileMenu);
097:
098: editMenu.setText("Edit");
099: cutMenuItem.setText("Cut");
100: editMenu.add(cutMenuItem);
101:
102: copyMenuItem.setText("Copy");
103: editMenu.add(copyMenuItem);
104:
105: pasteMenuItem.setText("Paste");
106: editMenu.add(pasteMenuItem);
107:
108: deleteMenuItem.setText("Delete");
109: editMenu.add(deleteMenuItem);
110:
111: menuBar.add(editMenu);
112:
113: helpMenu.setText("Help");
114: contentMenuItem.setText("Contents");
115: helpMenu.add(contentMenuItem);
116:
117: aboutMenuItem.setText("About");
118: helpMenu.add(aboutMenuItem);
119:
120: menuBar.add(helpMenu);
121:
122: setJMenuBar(menuBar);
123:
124: pack();
125: }//GEN-END:initComponents
126:
127: private void fileMenuActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_fileMenuActionPerformed
128: {//GEN-HEADEREND:event_fileMenuActionPerformed
129:
130: }//GEN-LAST:event_fileMenuActionPerformed
131:
132: private void exitMenuItemActionPerformed(
133: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
134: System.exit(0);
135: }//GEN-LAST:event_exitMenuItemActionPerformed
136:
137: /** Exit the Application */
138: private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
139: Main.getProperties().setProperty(
140: Main.PROPERTY_MAINFRAME_HEIGHT, "" + this .getHeight());
141: Main.getProperties().setProperty(Main.PROPERTY_MAINFRAME_WIDTH,
142: "" + this .getWidth());
143: Main.getProperties().setProperty(Main.PROPERTY_MAINFRAME_POSX,
144: "" + this .getBounds().x);
145: Main.getProperties().setProperty(Main.PROPERTY_MAINFRAME_POSY,
146: "" + this .getBounds().y);
147: Main.getProperties().storeProperties("");
148: System.exit(0);
149: }//GEN-LAST:event_exitForm
150:
151: /**
152: * @param args the command line arguments
153: */
154: public static void main(String args[]) {
155: new JFrmMain().show();
156: }
157:
158: // Variables declaration - do not modify//GEN-BEGIN:variables
159: private javax.swing.JMenu fileMenu;
160: private javax.swing.JMenuItem contentMenuItem;
161: private javax.swing.JMenuItem exitMenuItem;
162: private javax.swing.JMenuItem copyMenuItem;
163: private javax.swing.JMenuItem pasteMenuItem;
164: private javax.swing.JMenuItem cutMenuItem;
165: private javax.swing.JMenuBar menuBar;
166: private javax.swing.JMenu editMenu;
167: private javax.swing.JMenuItem aboutMenuItem;
168: private javax.swing.JMenu helpMenu;
169: private javax.swing.JMenuItem deleteMenuItem;
170: // End of variables declaration//GEN-END:variables
171:
172: }
|