Java Reference
In-Depth Information
265 }
266 }
267 };
268 creat.addActionListener(creatAction);
269
270 // function is to get selection from table and cd there
271 view.addActionListener(cdAction);
272 // but it starts off disabled, since there is no data yet
273 view.setEnabled(false);
274
275 // ------------------------------------------------------------
276 frame.getRootPane().setDefaultButton(creat);
277 clos.grabFocus();
278
279 return retval;
280
281 } // createButtons
282
283 public static void
284 main(String[] args)
285 {
286 BudgetPro app = null;
287
288 //Create the top-level container
289 JFrame frame = new JFrame("BudgetPro");
290
291 // ----------- set up the account/app based on the command line args
292 try {
293 String username = System.getProperty("user.name", "default");
294 if (args.length > 0) {
295 app = new BudgetPro(frame, username, args[0]);
296 } else {
297 System.err.println("usage: BudgetPro dollar_amt");
298 System.exit(1);
299 }
300 } catch (Exception e) {
301 System.err.println("Error on startup.");
302 e.printStackTrace();
303 System.exit(2);
304 }
305
306 // ----------- now set up the UI and get things going
307 try {
308 UIManager.setLookAndFeel(
309 UIManager.getCrossPlatformLookAndFeelClassName());
310 } catch (Exception e) {
311 System.err.println("Can't set the desired look and feel.");
312 e.printStackTrace();
313 System.exit(3);
Search WWH ::




Custom Search