Hi
I remember I searched for a solution to make JFrame respect the minimum size of itself or it's components, but unfortunately there is no solution, at least not a satisfactory one.
The force-a-resize-if-it-gets-too-small "solution" looks really bad so I desided to drop the whole thing.
However I've been testing around with different Look & Feels and changing the layout, and what I discovered is that when setting setDefaultLookAndFeelDecorated(true) the minimum size is respected.
I haven't seen anyone mentioning this I thought I'd post it here.
import javax.swing.*;
import java.awt.*;
class RespectMinimumSize extends JFrame {
RespectMinimumSize() {
setMinimumSize(new Dimension(400, 400));
setLocationRelativeTo(null);
pack();
setVisible(true);
}
public static void main(String [] args) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true); // Works with JDialog as well
Toolkit.getDefaultToolkit().setDynamicLayout(true);
new RespectMinimumSize();
}
}