Here you can find the source of setMinSizeFrame(JFrame frame)
public static void setMinSizeFrame(JFrame frame)
//package com.java2s; //License from project: Apache License import javax.swing.*; import java.awt.*; public class Main { public static void setMinSizeFrame(JFrame frame) { Dimension dimension = frame.getSize(); frame.pack();//from www. j av a 2 s .c o m frame.setMinimumSize(frame.getSize()); frame.setSize(dimension); } }