List of usage examples for javax.swing JTable isEnabled
public boolean isEnabled()
From source file:OAT.ui.util.UiUtil.java
public static void setupColumns(JTable table) { for (int i = 0; i < table.getColumnCount(); i++) { DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(); TableColumn column = table.getColumnModel().getColumn(i); Class columnClass = table.getColumnClass(i); String columnName = table.getColumnName(i); renderer.setToolTipText(columnName); if (columnClass.getSuperclass().equals(Number.class)) { renderer.setHorizontalAlignment(DefaultTableCellRenderer.RIGHT); }/*from w ww. j a va 2s. c om*/ if (table.isEnabled()) { if (columnName.equals("Currency")) { //addComboCell(column, Product.CURRENCIES); } else if (columnName.equals("Holidays")) { //column.setCellEditor(new FileChooserCellEditor()); } } column.setCellRenderer(renderer); } }
From source file:org.signserver.admin.gui.AddWorkerDialog.java
/** Creates new form AddWorkerDialog */ public AddWorkerDialog(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents();/*from w w w.jav a 2 s.c o m*/ stage = Stage.INITIAL_CONFIG; mode = Mode.LOAD_FROM_FILE; loadFromFileRadioButton.setSelected(true); updateControls(); // initially set the Next button to be greyed-out, so that it can be // enabled based on the state nextApplyButton.setEnabled(false); invalidWorkerIdStatusLabel.setVisible(false); propertiesTable.setDefaultRenderer(String.class, new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean selected, boolean focused, int row, int column) { setEnabled(table == null || table.isEnabled()); super.getTableCellRendererComponent(table, value, selected, focused, row, column); return this; } }); propertiesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { final boolean enable = propertiesTable.getSelectedRowCount() == 1; editPropertyButton.setEnabled(enable); removePropertyButton.setEnabled(enable); } } }); // add a document listner to update the UI when the content of the ID // combobox changes final JTextComponent component = (JTextComponent) workerIdComboBox.getEditor().getEditorComponent(); component.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent ev) { updateControls(); } @Override public void removeUpdate(DocumentEvent ev) { updateControls(); } @Override public void changedUpdate(DocumentEvent ev) { updateControls(); } }); // add a document listner to update the UI on updates of the configuration text configurationTextArea.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent ev) { configurationEdited = true; updateControls(); } @Override public void removeUpdate(DocumentEvent ev) { configurationEdited = true; updateControls(); } @Override public void changedUpdate(DocumentEvent ev) { configurationEdited = true; updateControls(); } }); }