Java Reference
In-Depth Information
216 } // createList
217
218 private Component
219 createButtons(JRootPane root)
220 {
221 JPanel retval = new JPanel(); // default: flow layout
222
223 //Lay out the buttons from left to right.
224 retval.setLayout(new BoxLayout(retval, BoxLayout.X_AXIS));
225 retval.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
226 retval.add(Box.createHorizontalGlue());
227 retval.add(creat);
228 retval.add(Box.createRigidArea(new Dimension(10, 0)));
229 retval.add(view);
230 retval.add(Box.createRigidArea(new Dimension(10, 0)));
231 retval.add(clos);
232
233 // ---------------------------------------- Define some actions
234 ActionListener closAction = new ActionListener()
235 {
236 public void
237 actionPerformed(ActionEvent e)
238 {
239 System.exit(0);
240 }
241 } ;
242 clos.addActionListener(closAction);
243
244 ActionListener creatAction = new ActionListener()
245 {
246 public void
247 actionPerformed(ActionEvent e)
248 {
249 Account child;
250 // get the info via a Dialog (of sorts)
251 if (askem == null) {
252 askem = new AcctDialog(frame, "New Subaccount");
253 } else {
254 askem.clear();
255 askem.setVisible(true);
256 }
257 String subName = askem.getName();
258 String subAmnt = askem.getAmnt();
259
260 // if empty, assume the operation was cancelled, else:
261 if ((subName != null) && (subName.length() > 0)) {
262 child = current.createSub(subName, subAmnt);
263 setStatus();
264 model.fireTableDataChanged(); // notify the table
Search WWH ::




Custom Search