Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Resizing JFrame with ChangeListener  RSS feed

 
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!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!