Here you can find the source of setSize(JComponent conponent, int width, int height)
public static void setSize(JComponent conponent, int width, int height)
//package com.java2s; /*//from ww w. ja v a2 s . c om * codjo.net * * Common Apache License 2.0 */ import java.awt.Dimension; import javax.swing.JComponent; public class Main { public static void setSize(JComponent conponent, int width, int height) { conponent.setMinimumSize(new Dimension(width, height)); conponent.setPreferredSize(new Dimension(width, height)); } }