Biblioteca Java - Blame information for rev 3
Subversion Repositories:
Rev | Author | Line No. | Line |
---|---|---|---|
3 | mihai | 1 | package lab.scd.db.tableview; |
2 | |||
3 | import javax.swing.JPanel; | ||
4 | import javax.swing.JFrame; | ||
5 | import java.awt.Dimension; | ||
6 | |||
7 | |||
8 | /** | ||
9 | * This code was generated using CloudGarden's Jigloo | ||
10 | * SWT/Swing GUI Builder, which is free for non-commercial | ||
11 | * use. If Jigloo is being used commercially (ie, by a corporation, | ||
12 | * company or business for any purpose whatever) then you | ||
13 | * should purchase a license for each developer using Jigloo. | ||
14 | * Please visit www.cloudgarden.com for details. | ||
15 | * Use of Jigloo implies acceptance of these licensing terms. | ||
16 | * ************************************* | ||
17 | * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED | ||
18 | * for this machine, so Jigloo or this code cannot be used legally | ||
19 | * for any corporate or commercial purpose. | ||
20 | * ************************************* | ||
21 | */ | ||
22 | import javax.swing.JScrollPane; | ||
23 | import java.awt.GridLayout; | ||
24 | import javax.swing.table.DefaultTableModel; | ||
25 | import javax.swing.table.TableModel; | ||
26 | import javax.swing.JTable; | ||
27 | public class TableJPanel extends javax.swing.JPanel { | ||
28 | private JScrollPane scrollP; | ||
29 | private JTable tableStoc; | ||
30 | private StocTable st; | ||
31 | |||
32 | public TableJPanel(StocTable st) { | ||
33 | super(); | ||
34 | this.st = st; | ||
35 | initGUI(); | ||
36 | |||
37 | } | ||
38 | |||
39 | private void initGUI() { | ||
40 | try { | ||
41 | GridLayout thisLayout = new GridLayout(1, 1); | ||
42 | this.setLayout(thisLayout); | ||
43 | setPreferredSize(new Dimension(400, 300)); | ||
44 | { | ||
45 | scrollP = new JScrollPane(); | ||
46 | this.add(scrollP); | ||
47 | { | ||
48 | /*TableModel tableStocModel = new DefaultTableModel( | ||
49 | new String[][] { { "One", "Two" }, { "Three", "Four" } }, | ||
50 | new String[] { "Column 1", "Column 2" }); | ||
51 | */ | ||
52 | tableStoc = new JTable(); | ||
53 | scrollP.setViewportView(tableStoc); | ||
54 | tableStoc.setModel(st); | ||
55 | } | ||
56 | } | ||
57 | } catch (Exception e) { | ||
58 | e.printStackTrace(); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * Auto-generated method for setting the popup menu for a component | ||
64 | */ | ||
65 | private void setComponentPopupMenu( | ||
66 | final java.awt.Component parent, | ||
67 | final javax.swing.JPopupMenu menu) { | ||
68 | parent.addMouseListener(new java.awt.event.MouseAdapter() { | ||
69 | public void mousePressed(java.awt.event.MouseEvent e) { | ||
70 | if (e.isPopupTrigger()) | ||
71 | menu.show(parent, e.getX(), e.getY()); | ||
72 | } | ||
73 | public void mouseReleased(java.awt.event.MouseEvent e) { | ||
74 | if (e.isPopupTrigger()) | ||
75 | menu.show(parent, e.getX(), e.getY()); | ||
76 | } | ||
77 | }); | ||
78 | } | ||
79 | |||
80 | } |