Locks a Jtable's column width with 'pixels' size. - Java 2D Graphics

Java examples for 2D Graphics:Pixel

Description

Locks a Jtable's column width with 'pixels' size.

Demo Code


//package com.java2s;

import javax.swing.table.TableColumn;

public class Main {
    /**/*w  w w  .  j a  va 2  s  .com*/
     * Locks a Jtable's column width with 'pixels' size.
     * <p>
     * @param tc       The table column.
     * @param pixels    The desired pixels.
     */
    public static void lockJTableColumnWidth(TableColumn tc, int pixels) {
        if (tc != null) {
            tc.setMinWidth(pixels);
            tc.setMaxWidth(pixels);
            tc.setPreferredWidth(pixels);
            tc.setResizable(false);
        }
    }
}

Related Tutorials