Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Resizing JFrame with ChangeListener

 
Kate Zoy
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JFrame that contains 5 JTabbedPane. I added a changeListener event to these JTabbedPane because I want to frame to be a different size depending on which tab you selected and are viewing. Here's the code for that:


Now, my problem is that is does resize when I go back to a smaller size, but all the components of that tab are left deformed. The components inside of the first 3 tabbed are left as if the frame was still big. If I resize the frame manually with my mouse, they come back to their shape. But not if I use the resize function... what can i do?
Thanks a bunch...
 
Eric Snell
Greenhorn
Posts: 28
Java Mac MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know about all the processing you're doing in response to the change event, but you might try using SwingUtilities.invokeLater() to do your frame resize and see if that helps.

Are you sure you want to change the size of the window when the user clicks a tab? Sounds like it be could annoying to the user.
[ June 11, 2004: Message edited by: Eric Snell ]
 
Kate Zoy
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, I figured it might be the best idea. I put the extra components in a different frame. Thanks for your help and advice!
 
please buy my thing and then I'll have more money:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!