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.

528Appendix BA Java Swing GUI for BudgetPro21 // gui comp<strong>on</strong>ents22 private JFrame frame; // needed by dialogs to root themselves23 private JLabel nam;24 private JLabel tot;25 private JLabel val;26 private JButt<strong>on</strong> upt<strong>on</strong> = new JButt<strong>on</strong>(new ImageIc<strong>on</strong>("net/multitool/gui/back.gif"));27 private JButt<strong>on</strong> creat = new JButt<strong>on</strong>("New Subaccount");28 private JButt<strong>on</strong> view = new JButt<strong>on</strong>("View Subaccount");29 private JButt<strong>on</strong> clos = new JButt<strong>on</strong>("Quit");3031 private JTable list;32 private AbstractTableModel model;3334 private AcctDialog askem; // make <strong>on</strong>ce, use often3536 // Set Up an Acti<strong>on</strong> for a Butt<strong>on</strong>37 private Acti<strong>on</strong>Listener upActi<strong>on</strong> = new Acti<strong>on</strong>Listener()38 {39 public void40 acti<strong>on</strong>Performed(Acti<strong>on</strong>Event e)41 {42 // this is the acti<strong>on</strong> for UP arrow ic<strong>on</strong>;43 Account next;44 next = current.getParent();45 if (next != null) {46 current = next;47 setStatus();48 // TODO: notify the table, too49 model.fireTableDataChanged();50 } // TODO: else infodialog or Beep.51 }52 } ;5354 private Acti<strong>on</strong>Listener cdActi<strong>on</strong> = new Acti<strong>on</strong>Listener()55 {56 public void57 acti<strong>on</strong>Performed(Acti<strong>on</strong>Event e)58 {59 // this is the acti<strong>on</strong> for VIEW subdirectory;60 // a "cd" into the subaccount.61 int row = list.getSelectedRow();62 // System.out.println("Row="+row); // DEBUG; TODO: REMOVE63 if (row > -1) { // <strong>on</strong>ly if a row was selected64 String subname = (String) model.getValueAt(row, 0); // name column65 Account next = current.getSub(subname);66 if (next != null) {67 current = next;68 // System.out.println("cd to:"+current.getName());

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

Saved successfully!

Ooh no, something went wrong!