if (modelColumn == 1) { editingClass = getModel().getValueAt(row, modelColumn).getClass(); return getDefaultEditor(editingClass); } else { return super.getCellEditor(row, column);
public void resetMetaData(JdbcMetaData aMetaData) { // Update the JdbcMetaData in the SchemaExplorer jdbcMetaData = aMetaData; // Update the database label String theLabel = getResourceConverter().getFormattedString( "schemaExplorer.database.text", "Database - {0} ({1})", jdbcMetaData.getDbCatalogName(), jdbcMetaData.getDatabaseProductName()); databaseLabel.setText(theLabel); // Update the JdbcMetaData in the SchemaTreeCellRenderer. renderer.setMetaData(aMetaData); // Update the JdbcMetaData in the SchemaPropertyCellEditor. TableCellEditor theTableCellEditor = propertyTable.getDefaultEditor( Object.class); if (theTableCellEditor instanceof SchemaPropertyCellEditor) { ((SchemaPropertyCellEditor) theTableCellEditor).setMetaData( aMetaData); } }
/** * Returns the editor of the combo box field. * * @param type * the column {@link Class} type. * * @return the {@link TableCellEditor}. */ public TableCellEditor getEditor(Class<?> type) { return getComponent().getDefaultEditor(type); }
private void initializeEditor() { super.setDefaultEditor(boolean.class, super.getDefaultEditor(Boolean.class)); super.setDefaultEditor(int.class, super.getDefaultEditor(Integer.class)); super.setDefaultEditor(long.class, super.getDefaultEditor(Long.class)); super.setDefaultEditor(double.class, super.getDefaultEditor(Double.class)); super.setDefaultEditor(float.class, super.getDefaultEditor(Float.class)); super.setDefaultEditor(short.class, super.getDefaultEditor(Short.class)); super.setDefaultEditor(byte.class, super.getDefaultEditor(Byte.class)); super.setDefaultEditor(char.class, super.getDefaultEditor(Character.class)); }
private final JTable table = new JTable(model); DefaultCellEditor ce = (DefaultCellEditor)table.getDefaultEditor(Object.class); JTextComponent tc = (JTextComponent)ce.getComponent(); JPopupMenu popup = new JPopupMenu(); //add items to popup here tc.setComponentPopupMenu(popup);
public void loadEditor(Class<?> cls, int col) { treeTableEditor = this; if (col == treeTable.getHierarchicalColumn()) { if (defaultTreeEditor == null) defaultTreeEditor = new TreeEditor(table.getDefaultEditor(Object.class)); defaultEditor = defaultTreeEditor; } else { defaultEditor = table.getDefaultEditor(table.getColumnClass(col)); } }
private JTable createGrid() { grid = new JTable(); grid.getDefaultEditor(String.class).addCellEditorListener(this); createTableModel(); grid.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); grid.setMinimumSize(new Dimension(200, 100)); return grid; }
private JTable createGrid() { grid = new JTable(); grid.getDefaultEditor(String.class).addCellEditorListener(this); createTableModel(); grid.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); grid.setMinimumSize(new Dimension(200, 100)); return grid; }
// Create a table. JTable table = new JTable(new DemoTableModel()); // Add the DateTimeTableEditor as the default editor and renderer for // the LocalDateTime data type. table.setDefaultEditor(LocalDateTime.class, new DateTimeTableEditor()); table.setDefaultRenderer(LocalDateTime.class, new DateTimeTableEditor()); // Explicitly set the default editor and renderer for column index 0. TableColumn column = table.getColumnModel().getColumn(0); column.setCellEditor(table.getDefaultEditor(LocalDateTime.class)); column.setCellRenderer(table.getDefaultRenderer(LocalDateTime.class));
// Create a table. JTable table = new JTable(new DemoTableModel()); // Add the DateTimeTableEditor as the default editor and renderer for // the LocalDateTime data type. table.setDefaultEditor(LocalDateTime.class, new DateTimeTableEditor()); table.setDefaultRenderer(LocalDateTime.class, new DateTimeTableEditor()); // Explicitly set the default editor and renderer for column index 0. TableColumn column = table.getColumnModel().getColumn(0); column.setCellEditor(table.getDefaultEditor(LocalDateTime.class)); column.setCellRenderer(table.getDefaultRenderer(LocalDateTime.class));
private JTable createGrid() { grid = new JTable(); grid.getDefaultEditor(String.class).addCellEditorListener(this); createTableModel(); grid.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); grid.setMinimumSize(new Dimension(200, 100)); return grid; }
private JTable createGrid() { grid = new JTable(); grid.getDefaultEditor(String.class).addCellEditorListener(this); createTableModel(); grid.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); grid.setMinimumSize(new Dimension(200, 100)); return grid; }
private JTable createGrid() { grid = new JTable(); grid.getDefaultEditor(String.class).addCellEditorListener(this); createTableModel(); grid.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); grid.setMinimumSize(new Dimension(200, 100)); return grid; }
private JTable createGrid() { grid = new JTable(); grid.getDefaultEditor(String.class).addCellEditorListener(this); createTableModel(); grid.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); grid.setMinimumSize(new Dimension(200, 100)); return grid; }
private JTable createGrid() { grid = new JTable(); grid.getDefaultEditor(String.class).addCellEditorListener(this); createTableModel(); grid.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); grid.setMinimumSize(new Dimension(200, 100)); return grid; }
@Override public TableCellEditor getDefaultEditor(Class columnClass) { if (!edCreated && (columnClass == TreeTableModelAdapter.class)) { //Creating this editor in the constructor can take > 100ms even //on a very fast machine, so do it lazily here to improve //performance of creating a TreeTable setDefaultEditor(TreeTableModelAdapter.class, new TreeTableCellEditor()); edCreated = true; } return super.getDefaultEditor(columnClass); }
protected <R> TableColumnExt addBooleanColumnToModel(TableColumnModel model, ColumnIdentifier<R> identifier, JTable table) { return addColumnToModel(model, table.getDefaultEditor(Boolean.class), table.getDefaultRenderer(Boolean.class), identifier); }
public TableCellEditor getDefaultEditor(Class columnClass) { if (!edCreated && columnClass == TreeTableModelAdapter.class) { //Creating this editor in the constructor can take > 100ms even //on a very fast machine, so do it lazily here to improve //performance of creating a TreeTable setDefaultEditor(TreeTableModelAdapter.class, new TreeTableCellEditor()); edCreated = true; } return super.getDefaultEditor(columnClass); }
public TableCellEditor getDefaultEditor(Class columnClass) { if (!edCreated && columnClass == TreeTableModelAdapter.class) { //Creating this editor in the constructor can take > 100ms even //on a very fast machine, so do it lazily here to improve //performance of creating a TreeTable setDefaultEditor(TreeTableModelAdapter.class, new TreeTableCellEditor()); edCreated = true; } return super.getDefaultEditor(columnClass); }
Icon normal = new ImageIcon(...); Icon selected = new ImageIcon(...); JTable table = new JTable(...); table.setRowHeight(...); TableCellRenderer renderer = table.getDefaultRenderer(Boolean.class); JCheckBox checkBoxRenderer = (JCheckBox)renderer; checkBoxRenderer.setIcon( normal ); checkBoxRenderer.setSelectedIcon( selected ); DefaultCellEditor editor = (DefaultCellEditor)table.getDefaultEditor(Boolean.class); JCheckBox checkBoxEditor = (JCheckBox)editor.getComponent(); checkBoxEditor.setIcon( normal ); checkBoxEditor.setSelectedIcon( selected );