Assuming a normal JFrame, I'm trying to get the inset values before the frame is made visible. I can get these values fine once the frame is made visible (and i suppose I could create the jframe offscreen), but was wondering if there is some way to tickle Java into setting the insets before visibility. Prior to this call, all inset values are zero.
Net, I'm trying to get the exact dimensions of a frames client area -- or said better, I'm trying to create a JFrame that has very specific client area dimensions.
Thanks in advance.
Will this help?
frame.pack();
System.out.println("Frame Insets : " + frame.getInsets() );
I'm trying to create a JFrame that has very specific client area dimensions.
Then you set the preferred size of the panel added to the frame:
panel.setPreferredSize( new Dimension(...) );
frame.add( panel );
frame.setResizable( false );
frame.pack();
frame.setVisible(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With