javax.swing.JTable.getDefaultEditor()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中javax.swing.JTable.getDefaultEditor()方法的一些代码示例,展示了JTable.getDefaultEditor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTable.getDefaultEditor()方法的具体详情如下:
包路径:javax.swing.JTable
类名称:JTable
方法名:getDefaultEditor

JTable.getDefaultEditor介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

if (modelColumn == 1) {
  editingClass = getModel().getValueAt(row, modelColumn).getClass();
  return getDefaultEditor(editingClass);
} else {
  return super.getCellEditor(row, column);

代码示例来源:origin: pentaho/mondrian

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);
  }
}

代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-corefields

/**
 * 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);
}

代码示例来源:origin: com.synaptix/SynaptixSwing

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));
}

代码示例来源:origin: stackoverflow.com

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);

代码示例来源:origin: de.sciss/jtreetable

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));
  }
}

代码示例来源:origin: undera/jmeter-plugins

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;
}

代码示例来源:origin: kg.apc/jmeter-plugins-extras

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;
}

代码示例来源:origin: stackoverflow.com

// 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));

代码示例来源:origin: stackoverflow.com

// 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));

代码示例来源:origin: undera/jmeter-plugins

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;
}

代码示例来源:origin: undera/jmeter-plugins

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;
}

代码示例来源:origin: kg.apc/jmeter-plugins-standard

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;
}

代码示例来源:origin: kg.apc/jmeter-plugins-standard

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;
}

代码示例来源:origin: kg.apc/jmeter-plugins-casutg

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;
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

@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);
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-application-swing

protected <R> TableColumnExt addBooleanColumnToModel(TableColumnModel model,
                           ColumnIdentifier<R> identifier,
                           JTable table) {
  return addColumnToModel(model,
              table.getDefaultEditor(Boolean.class),
              table.getDefaultRenderer(Boolean.class),
              identifier);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

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);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

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);
}

代码示例来源:origin: stackoverflow.com

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 );

相关文章

JTable类方法