• Post Reply Bookmark Topic Watch Topic
  • New Topic

scrollpane on JPanel  RSS feed

 
Lars Dav
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to be able to scroll in my TrainingProgram when the dimension exceed that of the GraphPanel but the scrollpane just wont activate.

I take it I need to do something more than just draw a line that is longer than my JPanel size.

any help would be appreciated.




 
Mikko Kohtamäki
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your TrainingGraph panel don't implement Scrollable interface, if you want it to scroll it's necessary when adding it into ScrollPane...

For example JList and JTable implements Scrollable interface.

And secondary TrainingGraph panel don't have any preferred size, it just paints something.

See How to Use Scroll Panes
 
Rob Camick
Ranch Hand
Posts: 2756
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no need to implement the Scrollable interface. The key point is the missing preferred size.
 
Samuel March
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.swing.JViewport
and insert a Component
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!