File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Component resize. What is best? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Component resize. What is best?" Watch "Component resize. What is best?" New topic
Author

Component resize. What is best?

Rachel Swailes
Ranch Hand

Joined: May 18, 2004
Posts: 434
I have a JFrame that has a bunch of components in it. These components have to adjest their size and certain other settings when the JFrame resizes. now I can capture the resize event but how do I make the components in the frame aware of the event?
R.Joe
Ranch Hand

Joined: Jun 16, 2004
Posts: 31
hello sir,
i hope your problem is sort out using pack() method instread of setSize() method of JFrame
[ June 28, 2004: Message edited by: Ravi Lekhwani ]
Abhik Sarkar
Ranch Hand

Joined: Jun 14, 2003
Posts: 61
Hi Rachel,

Based on the LayoutManager you have used, the components should automatically resize, when the frame is resized.

What Layout are you using?

Best regards,
Abhik.
Rachel Swailes
Ranch Hand

Joined: May 18, 2004
Posts: 434
Well, the base is BorderLayout but there are tonnes of components inside that. I've sort of solved the problem by getting the resize events to call methods on the different panels. The components do resize accordingly, but not ones that I have explicitly setSize on before. Like Sliders for example. I was just wondering how everyone else does it...

Thanks
Rachel
Abhik Sarkar
Ranch Hand

Joined: Jun 14, 2003
Posts: 61
Right. I guess if you have lots of components, it is somekind of a form. If so, you might want to consider using the FormLayout from
JGoodies. It might take a while to learn it, but it is very likely that you would end up with relly neat forms.

Hope this helps,
Abhik.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Component resize. What is best?