It's not a secret anymore!
The moose likes Swing / AWT / SWT and the fly likes JFrame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFrame" Watch "JFrame" New topic


raja syamala

Joined: Aug 15, 2001
Posts: 2
I have a class that extends JFrame and JPanel, JTabbedPane, JButtons etc.. are added to it. I am using
But when I maximize the window manually or resize the window the size of the contents in the frame are changing. Is there a way to set the size of the frame and its components to be constant all the time. I tried to use the same method on the components as well. But the problem still persists.
Tried using pack(). But didn't work the way I want it.
Please let me know if there is any way to set the fixed size.
Thanks in advance.
G Gordan

Joined: Aug 16, 2001
Posts: 1
you just set layout of content panel to null.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

If you follow the above hint, be sure to set the location and size of all your components using setBounds( x, y, w, h )...


Write once, run anywhere, because there's nowhere to hide! - /. A.C.
K Venugopal

Joined: Aug 07, 2001
Posts: 2
try using setResizable(false). This will disable resizing of your Frame.
hope this suffices.
Daniel Searson
Ranch Hand

Joined: Dec 03, 2000
Posts: 83
I'd also reccommend using setResizable(false) as using no layout manager can get messy.

- Daniel

Joined: Aug 21, 2001
Posts: 2
U will have to use GridBagLayout and set the fill factor for all the components as None.Then the components will retain its original size even if the screen was maximised.
Have you checked out Aspose?
subject: JFrame
It's not a secret anymore!