13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Appendix BA Java Swing GUI for BudgetPro52969setStatus();70 // notify the table, too71 model.fireTableDataChanged();72 } // TODO: else infodialog or Beep.73 }74 }75 } ;7677 // TEST ONLY:78 int testid = 0;7980 BudgetPro(JFrame frame, String username, String value)81 {82 this.frame = frame;83 top = new Account("TopLevel", new User(username), value);84 current = top;8586 } // c<strong>on</strong>structor8788 private Comp<strong>on</strong>ent89 createStatus()90 {91 JPanel retval = new JPanel(); // default: flow layout9293 upt<strong>on</strong>.addActi<strong>on</strong>Listener(upActi<strong>on</strong>);9495 nam = new JLabel("Account: Name");96 tot = new JLabel("Total: $");97 val = new JLabel("Remaining: $");9899 retval.add(upt<strong>on</strong>);100 retval.add(nam);101 retval.add(tot);102 retval.add(val);103104 setStatus();105106 return retval;107 } // createStatus108109 /**110 * Set the values of the status fields,111 * as when the account has changed.112 */113 private void114 setStatus()115 {116 nam.setText("Account: "+current.getName());117 tot.setText("Total: $"+current.getTotal());

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!