KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > gui > JDBCExplorer


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/gui/JDBCExplorer.java#4 $
3 // This software is subject to the terms of the Common Public License
4 // Agreement, available at the following URL:
5 // http://www.opensource.org/licenses/cpl.html.
6 // Copyright (C) 2002-2007 Julian Hyde and others
7 // All Rights Reserved.
8 // You must accept the terms of that agreement to use this software.
9 */

10 package mondrian.gui;
11
12 import java.sql.Connection JavaDoc;
13
14 /**
15  *
16  * @author sean
17  * @version $Id: //open/mondrian/src/main/mondrian/gui/JDBCExplorer.java#4 $
18  */

19 public class JDBCExplorer extends javax.swing.JPanel JavaDoc {
20     Connection JavaDoc connection;
21     JDBCTreeModel model;
22
23     /** Creates new form JDBCExplorer */
24     public JDBCExplorer() {
25         initComponents();
26     }
27
28     public JDBCExplorer(Connection JavaDoc c) {
29         this();
30         setConnection(c);
31     }
32
33     public void setConnection(Connection JavaDoc c) {
34         try {
35             this.connection = c;
36
37             model = new JDBCTreeModel(c);
38
39             tree.setModel(model);
40             //tree.addTreeSelectionListener(this);
41

42         } catch (Exception JavaDoc ex) {
43             ex.printStackTrace();
44         }
45     }
46
47     /** This method is called from within the constructor to
48      * initialize the form.
49      * WARNING: Do NOT modify this code. The content of this method is
50      * always regenerated by the Form Editor.
51      */

52     private void initComponents() {//GEN-BEGIN:initComponents
53
jSplitPane1 = new javax.swing.JSplitPane JavaDoc();
54         jScrollPane1 = new javax.swing.JScrollPane JavaDoc();
55         tree = new javax.swing.JTree JavaDoc();
56         jScrollPane2 = new javax.swing.JScrollPane JavaDoc();
57
58         setLayout(new java.awt.BorderLayout JavaDoc());
59
60         jSplitPane1.setDividerLocation(200);
61         jScrollPane1.setViewportView(tree);
62
63         jSplitPane1.setLeftComponent(jScrollPane1);
64
65         jSplitPane1.setRightComponent(jScrollPane2);
66
67         add(jSplitPane1, java.awt.BorderLayout.CENTER);
68
69     }//GEN-END:initComponents
70

71
72     // Variables declaration - do not modify//GEN-BEGIN:variables
73
private javax.swing.JScrollPane JavaDoc jScrollPane2;
74     private javax.swing.JScrollPane JavaDoc jScrollPane1;
75     private javax.swing.JTree JavaDoc tree;
76     private javax.swing.JSplitPane JavaDoc jSplitPane1;
77     // End of variables declaration//GEN-END:variables
78

79 }
80
81 // End JDBCExplorer.java
82
Popular Tags