public static void installInOneColumn(JTable table, int colViewIndex, int alignment) {
    """
	Installs alignment decorators in the table column at {@code colViewIndex}.
	
	@param table  a table.
	@param colViewIndex  the index of the column in the table <i>view</i>.
	@param alignment  one of the following constants:
	<ul>
	<li>{@link SwingConstants#LEFT}</li>
	<li>{@link SwingConstants#CENTER} (the default for image-only labels)</li>
	<li>{@link SwingConstants#RIGHT}</li>
	<li>{@link SwingConstants#LEADING} (the default for text-only labels)</li>
	<li>{@link SwingConstants#TRAILING}</li>
	</ul>
    """
        TableColumn tableColumn = table.getColumnModel().getColumn(colViewIndex);

        TableCellRenderer headerRenderer = tableColumn.getHeaderRenderer();
        if (headerRenderer == null) {
            headerRenderer = table.getTableHeader().getDefaultRenderer();
        }
        if (!(headerRenderer instanceof  RendererAlignmentDecorator)) {  // Don't install a redundant decorator.
            tableColumn.setHeaderRenderer(new RendererAlignmentDecorator(headerRenderer, alignment));
        }

        TableCellRenderer cellRenderer = tableColumn.getCellRenderer();
        if (cellRenderer == null) {
            cellRenderer = table.getDefaultRenderer(table.getColumnClass(colViewIndex));
        }
        if (!(cellRenderer instanceof RendererAlignmentDecorator)) {  // Don't install a redundant decorator.
            tableColumn.setCellRenderer(new RendererAlignmentDecorator(cellRenderer, alignment));
        }
    }
public static void installInOneColumn(JTable table, int colViewIndex, int alignment) {
        TableColumn tableColumn = table.getColumnModel().getColumn(colViewIndex);

        TableCellRenderer headerRenderer = tableColumn.getHeaderRenderer();
        if (headerRenderer == null) {
            headerRenderer = table.getTableHeader().getDefaultRenderer();
        }
        if (!(headerRenderer instanceof  RendererAlignmentDecorator)) {  // Don't install a redundant decorator.
            tableColumn.setHeaderRenderer(new RendererAlignmentDecorator(headerRenderer, alignment));
        }

        TableCellRenderer cellRenderer = tableColumn.getCellRenderer();
        if (cellRenderer == null) {
            cellRenderer = table.getDefaultRenderer(table.getColumnClass(colViewIndex));
        }
        if (!(cellRenderer instanceof RendererAlignmentDecorator)) {  // Don't install a redundant decorator.
            tableColumn.setCellRenderer(new RendererAlignmentDecorator(cellRenderer, alignment));
        }
    }
public static void installInOneColumn ( JTable table , int colViewIndex , int alignment ) { TableColumn tableColumn = table . getColumnModel ( ) . getColumn ( colViewIndex ) ; TableCellRenderer headerRenderer = tableColumn . getHeaderRenderer ( ) ; if ( headerRenderer == null ) { headerRenderer = table . getTableHeader ( ) . getDefaultRenderer ( ) ; } if ( ! ( headerRenderer instanceof RendererAlignmentDecorator ) ) { // Don't install a redundant decorator. tableColumn . setHeaderRenderer ( new RendererAlignmentDecorator ( headerRenderer , alignment ) ) ; } TableCellRenderer cellRenderer = tableColumn . getCellRenderer ( ) ; if ( cellRenderer == null ) { cellRenderer = table . getDefaultRenderer ( table . getColumnClass ( colViewIndex ) ) ; } if ( ! ( cellRenderer instanceof RendererAlignmentDecorator ) ) { // Don't install a redundant decorator. tableColumn . setCellRenderer ( new RendererAlignmentDecorator ( cellRenderer , alignment ) ) ; } }
Installs alignment decorators in the table column at {@code colViewIndex}.

@param table  a table.
@param colViewIndex  the index of the column in the table <i>view</i>.
@param alignment  one of the following constants:
<ul>
<li>{@link SwingConstants#LEFT}</li>
<li>{@link SwingConstants#CENTER} (the default for image-only labels)</li>
<li>{@link SwingConstants#RIGHT}</li>
<li>{@link SwingConstants#LEADING} (the default for text-only labels)</li>
<li>{@link SwingConstants#TRAILING}</li>
</ul>
Installs alignment decorators in the table column at { @code colViewIndex } .