Revision 1956 trunk/libraries/libGDBMS/src/com/hardcode/gdbms/gui/Frame.java
Frame.java | ||
---|---|---|
7 | 7 |
import javax.swing.JScrollPane; |
8 | 8 |
import javax.swing.JTable; |
9 | 9 |
import javax.swing.table.TableModel; |
10 |
|
|
11 |
|
|
10 | 12 |
/** |
13 |
* DOCUMENT ME! |
|
14 |
* |
|
11 | 15 |
* @author Fernando Gonz?lez Cort?s |
12 | 16 |
*/ |
13 | 17 |
public class Frame extends JFrame { |
14 |
|
|
15 | 18 |
private javax.swing.JPanel jContentPane = null; |
16 |
|
|
17 | 19 |
private JTable table = null; |
18 | 20 |
private JScrollPane jScrollPane = null; |
21 |
|
|
19 | 22 |
/** |
20 | 23 |
* This is the default constructor |
21 | 24 |
*/ |
... | ... | |
23 | 26 |
super(); |
24 | 27 |
initialize(); |
25 | 28 |
} |
26 |
|
|
27 |
public void setTableModel(TableModel t){ |
|
29 |
|
|
30 |
/** |
|
31 |
* DOCUMENT ME! |
|
32 |
* |
|
33 |
* @param t DOCUMENT ME! |
|
34 |
*/ |
|
35 |
public void setTableModel(TableModel t) { |
|
28 | 36 |
getTable().setModel(t); |
29 | 37 |
} |
30 |
|
|
38 |
|
|
31 | 39 |
/** |
32 | 40 |
* This method initializes this |
33 |
* |
|
34 |
* @return void |
|
35 | 41 |
*/ |
36 | 42 |
private void initialize() { |
37 |
this.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE); |
|
38 |
this.setSize(300,200); |
|
43 |
this.setSize(300, 200); |
|
39 | 44 |
this.setContentPane(getJContentPane()); |
40 | 45 |
this.setTitle("JFrame"); |
41 |
this.addWindowListener(new java.awt.event.WindowAdapter() { |
|
42 |
public void windowClosing(java.awt.event.WindowEvent e) { |
|
43 |
try { |
|
44 |
((GDBMSTableModel) getTable().getModel()).getDataSource().stop(); |
|
45 |
} catch (Exception e1) { |
|
46 |
e1.printStackTrace(); |
|
46 |
this.addWindowListener(new java.awt.event.WindowAdapter() { |
|
47 |
public void windowClosing(java.awt.event.WindowEvent e) { |
|
48 |
try { |
|
49 |
((GDBMSTableModel) getTable().getModel()).getDataSource() |
|
50 |
.stop(); |
|
51 |
} catch (Exception e1) { |
|
52 |
e1.printStackTrace(); |
|
53 |
} |
|
47 | 54 |
} |
48 |
} |
|
49 |
}); |
|
55 |
}); |
|
50 | 56 |
} |
57 |
|
|
51 | 58 |
/** |
52 | 59 |
* This method initializes jContentPane |
53 |
*
|
|
60 |
* |
|
54 | 61 |
* @return javax.swing.JPanel |
55 | 62 |
*/ |
56 | 63 |
private javax.swing.JPanel getJContentPane() { |
57 |
if(jContentPane == null) { |
|
64 |
if (jContentPane == null) {
|
|
58 | 65 |
jContentPane = new javax.swing.JPanel(); |
59 | 66 |
jContentPane.setLayout(new java.awt.BorderLayout()); |
60 | 67 |
jContentPane.add(getJScrollPane(), java.awt.BorderLayout.CENTER); |
61 | 68 |
} |
69 |
|
|
62 | 70 |
return jContentPane; |
63 | 71 |
} |
72 |
|
|
64 | 73 |
/** |
65 |
* This method initializes table
|
|
66 |
*
|
|
67 |
* @return javax.swing.JTable
|
|
68 |
*/
|
|
74 |
* This method initializes table |
|
75 |
* |
|
76 |
* @return javax.swing.JTable |
|
77 |
*/ |
|
69 | 78 |
private JTable getTable() { |
70 | 79 |
if (table == null) { |
71 | 80 |
table = new JTable(); |
72 | 81 |
} |
82 |
|
|
73 | 83 |
return table; |
74 | 84 |
} |
85 |
|
|
75 | 86 |
/** |
76 |
* This method initializes jScrollPane
|
|
77 |
*
|
|
78 |
* @return javax.swing.JScrollPane
|
|
79 |
*/
|
|
87 |
* This method initializes jScrollPane |
|
88 |
* |
|
89 |
* @return javax.swing.JScrollPane |
|
90 |
*/ |
|
80 | 91 |
private JScrollPane getJScrollPane() { |
81 | 92 |
if (jScrollPane == null) { |
82 | 93 |
jScrollPane = new JScrollPane(); |
83 | 94 |
jScrollPane.setViewportView(getTable()); |
84 | 95 |
} |
96 |
|
|
85 | 97 |
return jScrollPane; |
86 | 98 |
} |
87 |
} |
|
99 |
} |
Also available in: Unified diff