Example #1
0
 public void dispose() {
   carsTableModel.removeTableModelListener(this);
   carsTableModel.dispose();
   if (f != null) {
     f.dispose();
   }
   super.dispose();
 }
Example #2
0
 // add, find or save button
 public void buttonActionPerformed(java.awt.event.ActionEvent ae) {
   // log.debug("car button activated");
   if (ae.getSource() == findButton) {
     int rowindex = carsTableModel.findCarByRoadNumber(findCarTextBox.getText());
     if (rowindex < 0) {
       JOptionPane.showMessageDialog(
           this,
           MessageFormat.format(
               Bundle.getMessage("carWithRoadNumNotFound"),
               new Object[] {findCarTextBox.getText()}),
           Bundle.getMessage("carCouldNotFind"),
           JOptionPane.INFORMATION_MESSAGE);
       return;
     }
     // clear any sorts by column
     clearTableSort(carsTable);
     carsTable.changeSelection(rowindex, 0, false, false);
     return;
   }
   if (ae.getSource() == addButton) {
     if (f != null) {
       f.dispose();
     }
     f = new CarEditFrame();
     f.initComponents();
     f.setTitle(Bundle.getMessage("TitleCarAdd"));
   }
   if (ae.getSource() == saveButton) {
     if (carsTable.isEditing()) {
       log.debug("cars table edit true");
       carsTable.getCellEditor().stopCellEditing();
     }
     OperationsXml.save();
     saveTableDetails(carsTable);
     if (Setup.isCloseWindowOnSaveEnabled()) {
       dispose();
     }
   }
 }