1 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 24 public class JFrmMain extends javax.swing.JFrame { 25 26 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 t) 43 { 44 } 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 ()); 54 } 55 56 57 62 private void initComponents() { 64 menuBar = new javax.swing.JMenuBar (); 65 fileMenu = new javax.swing.JMenu (); 66 exitMenuItem = new javax.swing.JMenuItem (); 67 editMenu = new javax.swing.JMenu (); 68 cutMenuItem = new javax.swing.JMenuItem (); 69 copyMenuItem = new javax.swing.JMenuItem (); 70 pasteMenuItem = new javax.swing.JMenuItem (); 71 deleteMenuItem = new javax.swing.JMenuItem (); 72 helpMenu = new javax.swing.JMenu (); 73 contentMenuItem = new javax.swing.JMenuItem (); 74 aboutMenuItem = new javax.swing.JMenuItem (); 75 76 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); 77 addWindowListener(new java.awt.event.WindowAdapter () 78 { 79 public void windowClosing(java.awt.event.WindowEvent evt) 80 { 81 exitForm(evt); 82 } 83 }); 84 85 fileMenu.setText("File"); 86 fileMenu.addActionListener(new java.awt.event.ActionListener () 87 { 88 public void actionPerformed(java.awt.event.ActionEvent evt) 89 { 90 fileMenuActionPerformed(evt); 91 } 92 }); 93 94 exitMenuItem.setText("Exit"); 95 exitMenuItem.addActionListener(new java.awt.event.ActionListener () 96 { 97 public void actionPerformed(java.awt.event.ActionEvent 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 } 136 private void fileMenuActionPerformed(java.awt.event.ActionEvent evt) { 139 } 141 private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); 143 } 145 146 private void exitForm(java.awt.event.WindowEvent evt) { 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 } 155 158 public static void main(String args[]) { 159 new JFrmMain().show(); 160 } 161 162 private javax.swing.JMenu fileMenu; 164 private javax.swing.JMenuItem contentMenuItem; 165 private javax.swing.JMenuItem exitMenuItem; 166 private javax.swing.JMenuItem copyMenuItem; 167 private javax.swing.JMenuItem pasteMenuItem; 168 private javax.swing.JMenuItem cutMenuItem; 169 private javax.swing.JMenuBar menuBar; 170 private javax.swing.JMenu editMenu; 171 private javax.swing.JMenuItem aboutMenuItem; 172 private javax.swing.JMenu helpMenu; 173 private javax.swing.JMenuItem deleteMenuItem; 174 176 } 177 | Popular Tags |