Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with JTree inside JScrollPane inside JPanel

 
Akhil Jain
Ranch Hand
Posts: 74
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Craig Wood
Ranch Hand
Posts: 1535
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 74
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1535
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Akhil Jain
Ranch Hand
Posts: 74
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic