Java examples for Swing:JComponent
set JComponent Size
//package com.java2s; import java.awt.Dimension; import javax.swing.JComponent; public class Main { public static void setSize(JComponent widget, Dimension size) { widget.setMinimumSize(size);/* w w w . j av a2 s . c om*/ widget.setMaximumSize(size); widget.setPreferredSize(size); } }