@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; }
public ButtonCellEditor(CharacterFacade character) { this.character = character; button.addActionListener(this); button.setMargin(new Insets(0, 0, 0, 0)); container.setOpaque(true); container.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx = 1; gbc.weighty = 1; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.VERTICAL; container.add(button, gbc); }
public void setCompanionType(String type) { companionType = type; model.setCompanionType(type); selectButton.setText( LanguageBundle.getFormattedString("in_companionCreateType", type)); // $NON-NLS-1$ newCompanion = null; }
/** {@inheritDoc} */ @Override public void tabSelected() { // Refresh the character sheet as we have been displayed. LoadButtonAndSheetHandler action = (LoadButtonAndSheetHandler) loadButton.getAction(); if (action != null) { action.showCompanion(false); } }
@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; }
public ButtonCellRenderer() { button.setMargin(new Insets(0, 0, 0, 0)); setOpaque(true); setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx = 1; gbc.weighty = 1; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.VERTICAL; add(button, gbc); }
private void initComponents() { setTitle(LanguageBundle.getString("in_companionSelectRace")); // $NON-NLS-1$ setLayout(new BorderLayout()); Container container = getContentPane(); { final ListSelectionModel selectionModel = raceTable.getSelectionModel(); selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); selectionModel.addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { selectButton.setEnabled(!selectionModel.isSelectionEmpty()); } } }); } SearchFilterPanel searchBar = new SearchFilterPanel(); container.add(searchBar, BorderLayout.NORTH); raceTable.setDisplayableFilter(searchBar); raceTable.addActionListener(this); raceTable.setTreeViewModel(this); container.add(new JScrollPane(raceTable), BorderLayout.CENTER); JPanel buttonPane = new JPanel(new FlowLayout()); selectButton.addActionListener(this); selectButton.setEnabled(false); selectButton.setActionCommand("SELECT"); buttonPane.add(selectButton); JButton cancelButton = new JButton(LanguageBundle.getString("in_cancel")); cancelButton.addActionListener(this); cancelButton.setActionCommand("CANCEL"); buttonPane.add(cancelButton); container.add(buttonPane, BorderLayout.SOUTH); Utility.installEscapeCloseOperation(this); }