private void updateButtons() { int index = list.getSelectedIndex(); remove.setEnabled(index != -1 && listModel.getSize() != 0); moveUp.setEnabled(index > 0); moveDown.setEnabled(index != -1 && index != listModel.getSize() - 1); edit.setEnabled(index != -1); }
/** Listener to handle service list selection changes */ public void valueChanged(ListSelectionEvent e) { if (service_list.getSelectedIndex() == -1) { remove_service_button.setEnabled(false); } else { remove_service_button.setEnabled(true); } }