Пример #1
0
 private void newButtonActionPerformed(
     java.awt.event.ActionEvent evt) // GEN-FIRST:event_newButtonActionPerformed
     { // GEN-HEADEREND:event_newButtonActionPerformed
   ((DefaultTableModel) valuesTable.getModel()).addRow(new Object[] {"", ""});
   valuesTable.setRowSelectionInterval(
       valuesTable.getRowCount() - 1, valuesTable.getRowCount() - 1);
   rulePlugin.updateName();
   parent.modified = true;
 } // GEN-LAST:event_newButtonActionPerformed
Пример #2
0
  private void deleteButtonActionPerformed(
      java.awt.event.ActionEvent evt) // GEN-FIRST:event_deleteButtonActionPerformed
      { // GEN-HEADEREND:event_deleteButtonActionPerformed
    if (getSelectedRow() != -1 && !valuesTable.isEditing()) {
      ((DefaultTableModel) valuesTable.getModel()).removeRow(getSelectedRow());

      if (valuesTable.getRowCount() != 0) {
        if (lastIndex == 0) {
          valuesTable.setRowSelectionInterval(0, 0);
        } else if (lastIndex == valuesTable.getRowCount()) {
          valuesTable.setRowSelectionInterval(lastIndex - 1, lastIndex - 1);
        } else {
          valuesTable.setRowSelectionInterval(lastIndex, lastIndex);
        }
      }
      rulePlugin.updateName();
      parent.modified = true;
    }
  } // GEN-LAST:event_deleteButtonActionPerformed