Java JTable Cell Renderer configureColumn(JTable table, int columnNumber, Integer width, TableCellRenderer renderer, TableCellEditor editor)

Here you can find the source of configureColumn(JTable table, int columnNumber, Integer width, TableCellRenderer renderer, TableCellEditor editor)

Description

configure Column

License

LGPL

Declaration

public static void configureColumn(JTable table, int columnNumber, Integer width, TableCellRenderer renderer,
            TableCellEditor editor) 

Method Source Code

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

import javax.swing.JTable;

import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;

public class Main {
    public static void configureColumn(JTable table, int columnNumber, Integer width, TableCellRenderer renderer,
            TableCellEditor editor) {
        TableColumn column = table.getColumnModel().getColumn(columnNumber);
        if (width != null)
            column.setMaxWidth(width);/*ww w  .  j  a  v a2s  .co m*/
        if (renderer != null)
            column.setCellRenderer(renderer);
        if (editor != null)
            column.setCellEditor(editor);
    }
}

Related

  1. adaptToTable(final JComponent renderer, final JTable table, boolean isSelected, final boolean hasFocus, final int row, final int column)
  2. applyRenderers(final JTable table, final TableCellRenderer[] renderers)
  3. applyRenderers(final JTable table, final TableCellRenderer[] renderers)
  4. createDefaultTableCellRenderer()
  5. getCellRenderer(final int hMargin)
  6. getDefaultRenderer(JTable table, TableColumn column)
  7. getTableCellRendererClass( Class propType)