aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Problem with JTree inside JScrollPane inside JPanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with JTree inside JScrollPane inside JPanel" Watch "Problem with JTree inside JScrollPane inside JPanel" New topic
Author

Problem with JTree inside JScrollPane inside JPanel

Akhil Jain
Ranch Hand

Joined: Oct 14, 2004
Posts: 74
Hi Guys,

I am facing this issue and not getting any valid point to solve this.
I have a JFrame, which contains JSplitPane, JSplitPane's right component is set to a JPanel. This JPanel contains a method called create JTree which creates the JTree and wraps it inside JScrollPane and returns that JScrollPane to be added to a JPanel.

note: panel is a seperate class which extends JPanel and have method createTree() with return type is set as JScrollPane. I am adding this JscrollPane component inside JPanel at run time when user clicks on something at the LEFT COMPONENT of JFrame.



This is what i am doing basically when any action event is identified on left side component of JFrame.


all works fine........but when i resize the JFrame, the JPanel which contains JScrollPane having JTree remains to be of same size as it was when the JFrame was small in size.

I am using BorderLayout for JPanel and JFrame.


Thanks for your help in advance.
regards,
Akhil


-------------------------------<br />you can't move ahead, unless you try for it.
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
but when i resize the JFrame, the JPanel which contains JScrollPane having JTree
remains to be of same size as it was when the JFrame was small in size.

This line may have something to do with it:
scrollPane.setSize(objectViewPanel.getSize());
Akhil Jain
Ranch Hand

Joined: Oct 14, 2004
Posts: 74
I even tried removing that line...
Nothing happens.......

and please notice....that JPanel expands along with JFrame (i can see that, because i have put borders across the boundry of JPanel, but the JScrollPane (which contains the actual JTree) which resides in to this JPanel doesn't get expanded.)

regards...

Please Help.
Akhil
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Akhil Jain
Ranch Hand

Joined: Oct 14, 2004
Posts: 74
Thanks Craig,

But my problem is litle different, i have changed your code a bit, to include a JPanel as a right component and inside it, i am adding a scroll pane having JTree.

When you run this code again, you will get to know my exact problem.....
Please help me out with this.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with JTree inside JScrollPane inside JPanel