JSplitPane events

Hi,

I'm using a JSplitPane component with two JPanels inside each side of the SplitPane.

I'm using OneTouchExpandable property of JSplitPane and setting it to true initially.

When the split pane is first shown, both the panels are visible.

Well, I want to add code when the divider is collapsed.

What is the action performed for this just like action performed for jbutton?

Please help.

Thanks.

[447 byte] By [seemap123a] at [2007-11-27 8:01:18]
# 1
Don't know if there is any special event generated for this.You can try using a PropertyChangeListener. I know a "dividerLocation" event is generated.
camickra at 2007-7-12 19:43:23 > top of Java-index,Desktop,Core GUI APIs...
# 2

Thanks, I added a componentListener. It worked great.

Here, is just a code snippet . I thought it may be useful for someone else who might have had the same problem.

(((BasicSplitPaneUI)pairWorkAreaSpltPane.getUI()).getDivider()).addComponentListener(new ComponentAdapter() {

public void componentMoved(ComponentEvent ce) {

Component comp = pairWorkAreaSpltPane.getBottomComponent();

if( comp.getHeight() == 0){

// show top component help file

} else {

//show bottom component help file

}

}

});

seemap123a at 2007-7-12 19:43:23 > top of Java-index,Desktop,Core GUI APIs...