Java examples for Swing:JComponent
force JComponent Size
//package com.java2s; import java.awt.Dimension; import javax.swing.JComponent; public class Main { public static void forceSize(JComponent component, int width, int height) { Dimension d = new Dimension(width, height); component.setMinimumSize(d);/*from ww w .j ava 2 s . c o m*/ component.setMaximumSize(d); component.setPreferredSize(d); } }