1 package org.apache.ojb.tools.mapping.reversedb2.actions; 2 import org.apache.ojb.tools.mapping.reversedb2.gui.JDlgDBConnection; 3 import org.apache.ojb.tools.mapping.reversedb2.gui.JIFrmDatabase; 4 18 19 20 21 27 28 public class ActionOpenDatabase extends javax.swing.AbstractAction 29 { 30 31 javax.swing.JFrame containingFrame; 32 37 public ActionOpenDatabase(javax.swing.JFrame pcontainingFrame) 38 { 39 this.containingFrame = pcontainingFrame; 40 putValue(NAME, "Open Database"); 41 putValue(MNEMONIC_KEY, new Integer (java.awt.event.KeyEvent.VK_C)); 42 } 43 44 47 public void actionPerformed(java.awt.event.ActionEvent actionEvent) 48 { 49 new Thread () 50 { 51 public void run() 52 { 53 final java.sql.Connection conn = new JDlgDBConnection(containingFrame, false).showAndReturnConnection(); 54 if (conn != null) 55 { 56 javax.swing.SwingUtilities.invokeLater(new Runnable () 57 { 58 public void run() 59 { 60 JIFrmDatabase frm = new JIFrmDatabase(conn); 61 containingFrame.getContentPane().add(frm); 62 frm.setVisible(true); 63 } 64 }); 65 } 66 } 67 }.start(); 68 } 69 } 70 | Popular Tags |