Beispiel #1
0
 @Override
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   background.getTableCellRendererComponent(table, null, isSelected, hasFocus, row, column);
   setBackground(background.getBackground());
   value = table.getValueAt(row, 0);
   if (value instanceof CompanionFacade) {
     button.setText(LanguageBundle.getString("in_companionRemove")); // $NON-NLS-1$
   } else {
     button.setText(LanguageBundle.getString("in_companionCreateNew")); // $NON-NLS-1$
   }
   value = table.getValueAt(row, 1);
   if (value instanceof Boolean) {
     button.setEnabled((Boolean) value);
   } else {
     button.setEnabled(true);
   }
   return this;
 }
Beispiel #2
0
 @Override
 public Component getTableCellEditorComponent(
     JTable table, Object value, boolean isSelected, int row, int column) {
   background.getTableCellRendererComponent(table, null, true, false, row, column);
   container.setBackground(background.getBackground());
   selectedElement = table.getValueAt(row, 0);
   if (selectedElement instanceof CompanionFacade) {
     button.setText(LanguageBundle.getString("in_companionRemove")); // $NON-NLS-1$
     button.setActionCommand(REMOVE_COMMAND);
   } else {
     button.setText(LanguageBundle.getString("in_companionCreateNew")); // $NON-NLS-1$
     button.setActionCommand(CREATE_COMMAND);
   }
   return container;
 }