views:

397

answers:

2

I have a vertically split JSplitPane and when I move the divider down, it shifts the bottom component and the bottom gets cut off. Is there a way to specify the resize behavior of a JSplitPane so the top (of the bottom component) gets covered by the split pane and the bottom is the last thing to get covered?

thanks, Jeff

A: 

I think you might need to attach an event to the JSplitPane's resize event (I forget exactly what it's called). The event should then move the content up to suit.

jeef3
+2  A: 

The components are painted at the "(0,0)" position for each part of the split pane.

I guess you could create your own custom UI that does whatever you want.

A simpler approach might be to add the component to a scroll pane. You could then just let the scrollbars appear if required.

Or, if you really want only the bottom part of the component to be shown you could control the viewport position whenever the divider is moved. You can handle this by listening for a "dividerLocation" PropertyChangeEvent.

camickr
I went with the scrollpane approach. thanks.
Jeff Storey