private static void updateButtons(JTable table, final RowEditableTableModel tableModel,
                                    final JButton addButton,
                                    final JButton removeButton,
                                    final JButton upButton,
                                    final JButton downButton) {
    if (table.isEnabled()) {
      int index = table.getSelectedRow();
      if (0 <= index && index < tableModel.getRowCount()) {
        removeButton.setEnabled(true);
        upButton.setEnabled(index > 0);
        downButton.setEnabled(index < tableModel.getRowCount() - 1);
      }
      else {
        removeButton.setEnabled(false);
        upButton.setEnabled(false);
        downButton.setEnabled(false);
      }

      addButton.setEnabled(true);
    }
  }
private static void updateButtons(JTable table, final RowEditableTableModel tableModel,
                                    final JButton addButton,
                                    final JButton removeButton,
                                    final JButton upButton,
                                    final JButton downButton)