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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appendix BA Java Swing GUI for BudgetPro531167 for (Iterator itr=current.getAllSubs(); itr.hasNext(); )168 {169 count++;170 aa = (Account) itr.next();171 if (count > row) { break; }172 } // next173 switch (col) {174 case 0:175 retval = aa.getName();176 break;177 case 1:178 retval = aa.getOwner();179 break;180 case 2:181 retval = aa.getTotal();182 break;183 } // endswitch184 return retval;185 } // getValueAt186187 public boolean188 isCellEditable(int row, int col)189 {190 return false;191 } // isCellEditable192 };193 list = new JTable(model);194 list.setSelecti<strong>on</strong>Mode(ListSelecti<strong>on</strong>Model.SINGLE_SELECTION);195196 list.getSelecti<strong>on</strong>Model().addListSelecti<strong>on</strong>Listener(197 new ListSelecti<strong>on</strong>Listener()198 {199 public void200 valueChanged(ListSelecti<strong>on</strong>Event e)201 {202 ListSelecti<strong>on</strong>Model lsm = (ListSelecti<strong>on</strong>Model)e.getSource();203 if (lsm.isSelecti<strong>on</strong>Empty()) {204 view.setEnabled(false);205 } else {206 view.setEnabled(true);207 }208 } // valueChanged209 }210 );211212 retval = new JScrollPane(list);213214 return retval;215

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

Saved successfully!

Ooh no, something went wrong!