Custom component not wrappable in JScrollPane ?

Hi,

I've written a simple component that is a subclass of JComponent.
When I use this class in the GUI designer, I'm not able to surround the component with a JScrollPane (JSplitPane etc. are available, but the JScrollPane entry is disabled).
As far as I can see, wrapping a JComponent in a JScrollPane should be possible. I searched the forum and the help by I was unable to find out what I'm doing wrong here :-)

Can anyone clearify what needs to be done in order to enable wrapping in JScrollPanes for custom components ?

Thanks in advance,
Christian

3 comments
Comment actions Permalink

Hi,

Your custom component should implement Scrollable. Then Surround with JScrollPane will be available.

Alexander.

0
Comment actions Permalink

Works as advertised ;-)

Thanks,
Christian

0
Comment actions Permalink

ache wrote:

Hi,

Your custom component should implement Scrollable. Then Surround with JScrollPane will be available.

Alexander.



Let's say I'd like to wrap JPanel with the scroll pane. As we know, JPanel does not implement Scrollable. Hence, to implement what I want I should place scroll pane somewhere in the form, cut my panel with components and paste it into the scroll pane. Ctrl+Alt+T would be more usable than that. My point is, that I'd like to have the freedom to decide, which container to wrap with JScrollPane. When you are taking my freedom, I develop with less pleasure than I used to.

0

Please sign in to leave a comment.