Пример #1
0
 private void btnNewActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnNewActionPerformed
   Window w = SwingUtilities.getWindowAncestor(this);
   Frame owner = w instanceof Frame ? (Frame) w : null;
   CustomerDlg dlg = new CustomerDlg(owner);
   dlg.setLocationRelativeTo(this);
   dlg.setTitle("New Customer");
   Customer customer = new Customer();
   if (dlg.showDialog(customer)) {
     CustomerTask task = new CustomerTask(customer);
     task.execute();
   }
 } // GEN-LAST:event_btnNewActionPerformed
Пример #2
0
  private void btnEditActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnEditActionPerformed
    Window w = SwingUtilities.getWindowAncestor(this);
    Frame owner = w instanceof Frame ? (Frame) w : null;
    CustomerDlg dlg = new CustomerDlg(owner);
    dlg.setLocationRelativeTo(this);
    dlg.setTitle("Edit Customer");
    Customer customer = null;

    if (tblCustomer.getSelectedRow() != -1) {
      int row = tblCustomer.getSelectedRow();
      customer = customers.get(row);

      if (dlg.showDialog(customer)) {
        CustomerTask task = new CustomerTask(customer);
        task.execute();
      }
    } else {
      lblInfo.setText("Select a customer from table to Edit");
    }
  } // GEN-LAST:event_btnEditActionPerformed
Пример #3
0
 public void create(List<Customer> customers) {
   CustomerTask updatetask = new CustomerTask(customers, "BULKCREATE");
   updatetask.addPropertyChangeListener(this);
   updatetask.execute();
 }