Skip to main content

Any example on scrollable JXPanel?

4 replies [Last post]
sbozian
Offline
Joined: 2010-08-30
Points: 0

Can anyone provide me with a simple example that uses a scrollable JXPanel?

Well, the documentation of JXPanel says it is:

An extended JPanel that provides additional features. First, the component is Scrollable, using reasonable defaults.

However, I cannot make the JXPanel look scrollable!
Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kschaefe
Offline
Joined: 2006-06-08
Points: 0

The Scrollable interface provides better control for configuring the display of a JScrollPane. If the view in the scroll pane is Scrollable, then the scroll pane respects the behaviors defined by the implementation of the interface methods. JXPanel implements Scrollable to give you better control over JScrollPane's configuration and use, but it is not a scrolling container (ie. no scrollbars).

Karl

sbozian
Offline
Joined: 2010-08-30
Points: 0

Thank you so much for the clarification. I wasn't distinguishing between "implementing Scrollable" and "actually being a scrolling container".

So can I conclude that everytime I want to "see scrollbars", I need to use JScrollPane in whatever container that implements Scrollable (like JXPanel)?

kleopatra
Offline
Joined: 2003-06-11
Points: 0

guess you mean the other way round: you need to use JXPanel in a JScrollPane :-) Note the the scrollBars might not appear, because the default tracksScrollableHeight/Width in JXPanel is implemented to return true (via the ScrollableSizeHint which defaults to FIT).

Cheers
Jeanette

kschaefe
Offline
Joined: 2006-06-08
Points: 0

Yes.

Karl