This is a sample of the code that I am using to instantiate a JFrame:
public class TestFrame{
public static void main(String[] args){
JFrame frame = new JFrame();
Insets insets = frame.getInsets();
frame.setSize(new Dimension(insets.right + insets.left + 400, insets.bottom + insets.top + 400));
System.out.println(String.format("Top = %d \nBottom = %d \nLeft = %d \n Right
= %d", insets.top, insets.bottom, insets.left, insets.right));
frame.setResizable(false);
frame.setVisible(true);
}
}
The frame is displaying fine but all of the insets seem to be equal to zero. I need to know the size of the title bar on top because I want a Content Pane of size 400x400 exactly.
I tested it on multiple platforms and the same thing happens on windows and on mac.
What am I doing wrong ?