• 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

Custom Objects and JScrollpane

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to get the Vector Visuals library to work with a JScrollPane. However I don't understand how the object to be scrolled reports its size to the scrollpane.

I have tried calling setModel directly on the horizontal scrollbar as an experiment, but the scrollbar still shows as if there is no scrolling required.

Ultimately I want to make the scrollpane move a viewport around the vector world that vector visuals is rendering, but I can't get past this initial step.

How does the object to be scrolled report its actual size to the JScrollPane?
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

How does the object to be scrolled report its actual size to the JScrollPane?



Two alternatives:

1. By implementing the javax.swing.Scrollable interface;
or
2. By its getPreferredSize() method.

The first case is used by components such as JTable, JTree, and JTextArea.
The second is used, for instance, when you place a JPanel in a JScrollPane. The scrollpane will use the preferred size of the panel to decide if scrolling is needed or not.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic