Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Change JFrame content pane without window resizing

 
Jon Brasted
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

Inside a JFrame's container, I have a JPanel. I have a JScrollPane inside that which currently has a JTextArea object. Using a menu item, I want to be able to change the contents of the scroll pane to a JTree. I can currently do it by getting the JPanel and then adding a new JScollPane object containing the JTree. However, when I do so, the frame shrinks and then (nearly) instantly resizes. I want the frame to 'stay put'.

Is there any way of doing this?

Thanks,
Jon
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you post a sample program, similar to below, showing the problem.

simple demo from your description, seems to work OK

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic