Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Component resize. What is best?

 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic