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

Scroll Bars  RSS feed

 
jack nick
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there,
Have a JTree which is the client for a JScrollPane. The JScrollPane is added to a panel which is a part of an applet. What does it take to get scroll bar as needed to to the scroll pane.
Have already set the ScrollBar policies as
scrollPane = new JScrollPane(tree);
scrollPane.setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setHorizontalScrollBarPolicy (JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setPreferredSize(new Dimension (650,400));
this.add(scrollPane);
Thanks
Jack
 
Rene Liebmann
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think, you don't need to set the policies.
It is enough to create an empty JScrollPane.

If this doesn't work, please give a bit more code, but leave it simple.
 
jack nick
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks mate it works
regards
jack
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!