Here you can find the source of lockInMinSize(final JFrame frame)
public static void lockInMinSize(final JFrame frame)
//package com.java2s; // GNU General Public License: // import java.awt.event.ComponentEvent; import javax.swing.*; public class Main { public static void lockInMinSize(final JFrame frame) { //Ensures user cannot resize frame to be smaller than frame is right now. final int origX = frame.getSize().width; final int origY = frame.getSize().height; //frame.setSize(new Dimension(origX, origY)); frame.addComponentListener(new java.awt.event.ComponentAdapter() { @Override//ww w. j a v a2 s. co m public void componentResized(ComponentEvent event) { frame.setSize(Math.max(frame.getWidth(), origX), Math.max(frame.getHeight(), origY)); frame.repaint(); } }); } }