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

JScrollPane and Canvas problem

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi!
I have a panel, whose layout is GridLayout, that contains Canvas Objects, each in its own new JPanel. All of the canvas objects are lined in one column, using the GridLayout. New canvas objects can be added dynamically to the panel, at the bottom.
Now, this panel is contained in a JScrollPane. As long as there is no need for the scrollbars to appear, i.e. all of the canvas object can be shown together, there is no problem.
But, when scroll is needed, the region of the canvas that need not to be shown until scrolled to it is still visible.
I mean: the scroll works ok, I can scroll both horizontally and vertically, but all of the canvas objects that need to be hidden at the bottom (and their rightmost regions) are visible, overriding other components below the scrollpane, and the scrollpane's vertical scrollbar.
How can I fix it, so that whenever I scroll, all of the unnecessary drawing will be hidden until scrolled to?
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Already answered in this thread... so I'm closing this one...

-Nate
    Bookmark Topic Watch Topic
  • New Topic