Java JTable Cell Editor installSimpleRenderesAndEditors(JTable table)

Here you can find the source of installSimpleRenderesAndEditors(JTable table)

Description

install Simple Renderes And Editors

License

Apache License

Declaration

public static void installSimpleRenderesAndEditors(JTable table) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.swing.*;

import java.util.HashMap;

import java.util.Map;

public class Main {
    public static void installSimpleRenderesAndEditors(JTable table) {
        Map<Class, Class> map = new HashMap<Class, Class>();
        map.put(boolean.class, Boolean.class);
        map.put(byte.class, Number.class);
        map.put(short.class, Number.class);
        map.put(int.class, Number.class);
        map.put(long.class, Number.class);
        map.put(float.class, Number.class);
        map.put(double.class, Number.class);
        for (Class newType : map.keySet()) {
            Class existingType = map.get(newType);
            table.setDefaultRenderer(newType, table.getDefaultRenderer(existingType));
            table.setDefaultEditor(newType, table.getDefaultEditor(existingType));
        }/*from   w  w w  .ja va  2  s.  co  m*/
    }
}

Related

  1. cancelTableEditing(final JTable table)
  2. createComboBox(Object items[], ActionListener listener, boolean editable)
  3. createEditableComboBox(String strActionCommand, ActionListener alListener, int iPreferredWidth)
  4. createTransclucentJTextAreaWithNoBorder(String text, boolean editable, boolean lineWrap, boolean wrapStyleWord)
  5. genHyperLinkEditor(final String uri, final Logger logger)
  6. isEditable(Component comp)
  7. processEditorRemovel(JTable aTable)
  8. setCellEditor(JTable table, int columnIdx, TableCellEditor editor)
  9. setCharacterAttributes(final AttributeSet attr, final boolean replace, final JEditorPane editorPane, final StyledDocument doc, final MutableAttributeSet inputAttrs)