• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Resizing JFrame with ChangeListener

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Greenhorn
Posts: 28
Mac MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
This tiny ad is guaranteed to be gluten free.
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic