• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with JTree inside JScrollPane inside JPanel

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Akhil Jain
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Forget Steve. Look at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic