Here you can find the source of setSize(JComponent componenet, Dimension dimension)
public static void setSize(JComponent componenet, Dimension dimension)
//package com.java2s; //License from project: LGPL import java.awt.*; import javax.swing.*; public class Main { public static void setSize(JComponent componenet, Dimension dimension) { componenet.setMinimumSize(dimension); componenet.setMaximumSize(dimension); componenet.setPreferredSize(dimension); }/*from w ww. jav a 2s . c o m*/ }