Here you can find the source of setComponentWidth(final JComponent component, final int width)
Parameter | Description |
---|---|
component | a parameter |
width | a parameter |
public static void setComponentWidth(final JComponent component, final int width)
//package com.java2s; // it under the terms of the GNU General Public License as published by import javax.swing.*; import java.awt.*; public class Main { public static final int HEIGHT_ROW = 27; /*********************************************************************************************** * Adjust the width of the specified component. */*from w w w. j av a 2s. c o m*/ * @param component * @param width */ public static void setComponentWidth(final JComponent component, final int width) { if ((component != null) && (width > 0)) { component.setMaximumSize(new Dimension(width, HEIGHT_ROW)); component.setPreferredSize(new Dimension(width, HEIGHT_ROW)); } } }