Biblioteca Java - Blame information for rev 3
Subversion Repositories:
Rev | Author | Line No. | Line |
---|---|---|---|
3 | mihai | 1 | package lab.scd.db.movecursor; |
2 | |||
3 | import javax.swing.JPanel; | ||
4 | import javax.swing.JFrame; | ||
5 | import java.awt.Dimension; | ||
6 | import java.awt.event.ActionEvent; | ||
7 | import java.awt.event.ActionListener; | ||
8 | |||
9 | |||
10 | /** | ||
11 | * This code was generated using CloudGarden's Jigloo | ||
12 | * SWT/Swing GUI Builder, which is free for non-commercial | ||
13 | * use. If Jigloo is being used commercially (ie, by a corporation, | ||
14 | * company or business for any purpose whatever) then you | ||
15 | * should purchase a license for each developer using Jigloo. | ||
16 | * Please visit www.cloudgarden.com for details. | ||
17 | * Use of Jigloo implies acceptance of these licensing terms. | ||
18 | * ************************************* | ||
19 | * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED | ||
20 | * for this machine, so Jigloo or this code cannot be used legally | ||
21 | * for any corporate or commercial purpose. | ||
22 | * ************************************* | ||
23 | */ | ||
24 | import javax.swing.BorderFactory; | ||
25 | import javax.swing.border.BevelBorder; | ||
26 | import com.cloudgarden.layout.AnchorLayout; | ||
27 | import javax.swing.JButton; | ||
28 | import javax.swing.JTextField; | ||
29 | import com.cloudgarden.layout.AnchorConstraint; | ||
30 | import javax.swing.JLabel; | ||
31 | public class StocJPanel extends javax.swing.JPanel implements ActionListener{ | ||
32 | |||
33 | StocTable st; | ||
34 | |||
35 | private JLabel lbName; | ||
36 | private JTextField tfName; | ||
37 | private JTextField tfPret; | ||
38 | private JButton bModif; | ||
39 | private JButton bNew; | ||
40 | private JButton bNext; | ||
41 | private JButton bPrev; | ||
42 | private JLabel lbPret; | ||
43 | |||
44 | /** | ||
45 | * Auto-generated main method to display this | ||
46 | * JPanel inside a new JFrame. | ||
47 | */ | ||
48 | public static void main(String[] args) { | ||
49 | JFrame frame = new JFrame(); | ||
50 | frame.getContentPane().add(new StocJPanel(null)); | ||
51 | frame.pack(); | ||
52 | frame.show(); | ||
53 | } | ||
54 | |||
55 | public StocJPanel(StocTable st) { | ||
56 | super(); | ||
57 | this.st = st; | ||
58 | initGUI(); | ||
59 | //move to first row | ||
60 | try{ | ||
61 | st.next(this); | ||
62 | }catch(Exception e){ | ||
63 | e.printStackTrace(); | ||
64 | } | ||
65 | } | ||
66 | |||
67 | private void initGUI() { | ||
68 | try { | ||
69 | this.setPreferredSize(new java.awt.Dimension(351, 290)); | ||
70 | AnchorLayout thisLayout = new AnchorLayout(); | ||
71 | this.setLayout(thisLayout); | ||
72 | this.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, null, null, null, null)); | ||
73 | { | ||
74 | bModif = new JButton(); | ||
75 | this.add(bModif, new AnchorConstraint( | ||
76 | 207, | ||
77 | 87, | ||
78 | 53, | ||
79 | 186, | ||
80 | AnchorConstraint.ANCHOR_ABS, | ||
81 | AnchorConstraint.ANCHOR_ABS, | ||
82 | AnchorConstraint.ANCHOR_ABS, | ||
83 | AnchorConstraint.ANCHOR_ABS)); | ||
84 | bModif.setText("Modify"); | ||
85 | bModif.setPreferredSize(new java.awt.Dimension(78, 30)); | ||
86 | bModif.addActionListener(this); | ||
87 | } | ||
88 | { | ||
89 | bNew = new JButton(); | ||
90 | this.add(bNew, new AnchorConstraint( | ||
91 | 207, | ||
92 | 206, | ||
93 | 53, | ||
94 | 70, | ||
95 | AnchorConstraint.ANCHOR_ABS, | ||
96 | AnchorConstraint.ANCHOR_ABS, | ||
97 | AnchorConstraint.ANCHOR_ABS, | ||
98 | AnchorConstraint.ANCHOR_ABS)); | ||
99 | bNew.setText("New"); | ||
100 | bNew.setPreferredSize(new java.awt.Dimension(75, 30)); | ||
101 | bNew.addActionListener(this); | ||
102 | } | ||
103 | { | ||
104 | bNext = new JButton(); | ||
105 | this.add(bNext, new AnchorConstraint( | ||
106 | 160, | ||
107 | 86, | ||
108 | 101, | ||
109 | 182, | ||
110 | AnchorConstraint.ANCHOR_ABS, | ||
111 | AnchorConstraint.ANCHOR_ABS, | ||
112 | AnchorConstraint.ANCHOR_ABS, | ||
113 | AnchorConstraint.ANCHOR_ABS)); | ||
114 | bNext.setText("Next"); | ||
115 | bNext.setPreferredSize(new java.awt.Dimension(83, 29)); | ||
116 | bNext.addActionListener(this); | ||
117 | } | ||
118 | { | ||
119 | bPrev = new JButton(); | ||
120 | this.add(bPrev, new AnchorConstraint( | ||
121 | 161, | ||
122 | 200, | ||
123 | 100, | ||
124 | 65, | ||
125 | AnchorConstraint.ANCHOR_ABS, | ||
126 | AnchorConstraint.ANCHOR_ABS, | ||
127 | AnchorConstraint.ANCHOR_ABS, | ||
128 | AnchorConstraint.ANCHOR_ABS)); | ||
129 | bPrev.setText("Previous"); | ||
130 | bPrev.setPreferredSize(new java.awt.Dimension(86, 29)); | ||
131 | bPrev.addActionListener(this); | ||
132 | } | ||
133 | { | ||
134 | tfPret = new JTextField(); | ||
135 | this.add(tfPret, new AnchorConstraint( | ||
136 | 91, | ||
137 | 65, | ||
138 | 169, | ||
139 | 95, | ||
140 | AnchorConstraint.ANCHOR_ABS, | ||
141 | AnchorConstraint.ANCHOR_ABS, | ||
142 | AnchorConstraint.ANCHOR_ABS, | ||
143 | AnchorConstraint.ANCHOR_ABS)); | ||
144 | tfPret.setPreferredSize(new java.awt.Dimension(191, 30)); | ||
145 | } | ||
146 | { | ||
147 | lbPret = new JLabel(); | ||
148 | this.add(lbPret, new AnchorConstraint( | ||
149 | 92, | ||
150 | 248, | ||
151 | 168, | ||
152 | 43, | ||
153 | AnchorConstraint.ANCHOR_ABS, | ||
154 | AnchorConstraint.ANCHOR_ABS, | ||
155 | AnchorConstraint.ANCHOR_ABS, | ||
156 | AnchorConstraint.ANCHOR_ABS)); | ||
157 | lbPret.setText("Pret"); | ||
158 | lbPret.setPreferredSize(new java.awt.Dimension(60, 30)); | ||
159 | } | ||
160 | { | ||
161 | tfName = new JTextField(); | ||
162 | this.add(tfName, new AnchorConstraint( | ||
163 | 56, | ||
164 | 67, | ||
165 | 204, | ||
166 | 95, | ||
167 | AnchorConstraint.ANCHOR_ABS, | ||
168 | AnchorConstraint.ANCHOR_ABS, | ||
169 | AnchorConstraint.ANCHOR_ABS, | ||
170 | AnchorConstraint.ANCHOR_ABS)); | ||
171 | tfName.setPreferredSize(new java.awt.Dimension(189, 30)); | ||
172 | } | ||
173 | { | ||
174 | lbName = new JLabel(); | ||
175 | this.add(lbName, new AnchorConstraint( | ||
176 | 56, | ||
177 | 249, | ||
178 | 204, | ||
179 | 42, | ||
180 | AnchorConstraint.ANCHOR_ABS, | ||
181 | AnchorConstraint.ANCHOR_ABS, | ||
182 | AnchorConstraint.ANCHOR_ABS, | ||
183 | AnchorConstraint.ANCHOR_ABS)); | ||
184 | lbName.setText("Nume"); | ||
185 | lbName.setPreferredSize(new java.awt.Dimension(60, 30)); | ||
186 | } | ||
187 | } catch (Exception e) { | ||
188 | e.printStackTrace(); | ||
189 | } | ||
190 | } | ||
191 | |||
192 | /** | ||
193 | * Auto-generated method for setting the popup menu for a component | ||
194 | */ | ||
195 | private void setComponentPopupMenu( | ||
196 | final java.awt.Component parent, | ||
197 | final javax.swing.JPopupMenu menu) { | ||
198 | parent.addMouseListener(new java.awt.event.MouseAdapter() { | ||
199 | public void mousePressed(java.awt.event.MouseEvent e) { | ||
200 | if (e.isPopupTrigger()) | ||
201 | menu.show(parent, e.getX(), e.getY()); | ||
202 | } | ||
203 | public void mouseReleased(java.awt.event.MouseEvent e) { | ||
204 | if (e.isPopupTrigger()) | ||
205 | menu.show(parent, e.getX(), e.getY()); | ||
206 | } | ||
207 | }); | ||
208 | } | ||
209 | |||
210 | |||
211 | public void actionPerformed(ActionEvent arg0) { | ||
212 | //verific butonul apasat | ||
213 | Object o = arg0.getSource(); | ||
214 | try{ | ||
215 | if(o==bNext){ | ||
216 | //buton next apasat | ||
217 | st.next(this); | ||
218 | } | ||
219 | |||
220 | if(o==bPrev){ | ||
221 | //buton previous apasat | ||
222 | st.previous(this); | ||
223 | } | ||
224 | |||
225 | if(o==bNew){ | ||
226 | |||
227 | st.newRecord(this); | ||
228 | } | ||
229 | |||
230 | if(o==bModif){ | ||
231 | st.modifyRecord(this); | ||
232 | } | ||
233 | }catch(Exception e){ | ||
234 | e.printStackTrace(); | ||
235 | } | ||
236 | } | ||
237 | |||
238 | public void setName(String s){ | ||
239 | this.tfName.setText(s); | ||
240 | } | ||
241 | |||
242 | public void setPret(String s){ | ||
243 | this.tfPret.setText(s); | ||
244 | } | ||
245 | |||
246 | public String getName(){ | ||
247 | return tfName.getText(); | ||
248 | } | ||
249 | |||
250 | public String getPret(){ | ||
251 | return tfPret.getText(); | ||
252 | } | ||
253 | } |