Java JTable Cell Editor setDefaultTableEditorsClicks(JTable table, int clickCountToStart)

Here you can find the source of setDefaultTableEditorsClicks(JTable table, int clickCountToStart)

Description

setDefaultTableEditorsClicks, This sets the number of clicks required to start the default table editors in the supplied table.

License

Open Source License

Declaration

public static void setDefaultTableEditorsClicks(JTable table, int clickCountToStart) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.DefaultCellEditor;
import javax.swing.JTable;

import javax.swing.table.TableCellEditor;

public class Main {
    /**/*  w  w  w . j a  va2 s .c  om*/
     * setDefaultTableEditorsClicks, This sets the number of clicks required to start the default
     * table editors in the supplied table. Typically you would set the table editors to start after
     * 1 click or 2 clicks, as desired.
     *
     * The default table editors of the table editors that are supplied by the JTable class, for
     * Objects, Numbers, and Booleans. Note, the editor which is used to edit Objects, is the same
     * editor used for editing Strings.
     */
    public static void setDefaultTableEditorsClicks(JTable table, int clickCountToStart) {
        TableCellEditor editor;
        editor = table.getDefaultEditor(Object.class);
        if (editor instanceof DefaultCellEditor) {
            ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart);
        }
        editor = table.getDefaultEditor(Number.class);
        if (editor instanceof DefaultCellEditor) {
            ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart);
        }
        editor = table.getDefaultEditor(Boolean.class);
        if (editor instanceof DefaultCellEditor) {
            ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart);
        }
    }
}

Related

  1. processEditorRemovel(JTable aTable)
  2. setCellEditor(JTable table, int columnIdx, TableCellEditor editor)
  3. setCharacterAttributes(final AttributeSet attr, final boolean replace, final JEditorPane editorPane, final StyledDocument doc, final MutableAttributeSet inputAttrs)
  4. setClickCountToStartEditing(JTable table, int count)
  5. setClickCountToStartEditing(JTable table, int count)
  6. setEditable(JSpinner spinner, boolean bool)
  7. setEditable(JTextComponent component, boolean editable)
  8. setEditable(JTextComponent... components)
  9. setEditableFalse(JTextField field)