How to add Listener for 'setOneTouchExpandable' of JSplitPane ?

Hi Friends

I set setOneTouchExpandable to true for my JSplitPane by:

splitPane.setOneTouchExpandable(true);

I want to add Listener to that setOneTouchExpandable when user click on that little triangle button of SplitPane's Divider.

I tried this:

BasicSplitPaneDivider divider = ((BasicSplitPaneUI)splitPane.getUI()).getDivider();

divider.addMouseListener(new MouseListener(){

public void mouseClicked(MouseEvent e) {}

public void mousePressed(MouseEvent e) {}

public void mouseReleased(MouseEvent e) {

viewerSize.width = getWidth();

viewerSize.height = getHeight();

fp.setSize(movieScrollPane.getViewport().getWidth(),movieScrollPane.getViewport().getHeight());

fp.validate();

}

public void mouseEntered(MouseEvent e) {}

public void mouseExited(MouseEvent e) {}

});

But this work only when user drag the divider.It's MouseClick event doesn't work for setOneTouchExpandablebutton which is on splitPan's divider.

So My question is how can I add listener for setOneTouchExpandable when user click on it?

Your any suggestion regarding this topic is valuable for me.

Thanks with hope someone has solution & will reply.

Kirti

[1268 byte] By [Kirti_Mistrya] at [2007-11-27 0:27:48]
# 1

1) Swing related questions should be posted in the Swing forum.

2) Use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the posted code retains its original formatting.

3) If we knew what you where trying to accomplish, making we could make an alternate suggestion.

Since you have the divider, you would probably need to iterate through the components added to the divider and add you ActionListener to the buttons on the divider.

camickra at 2007-7-11 22:28:01 > top of Java-index,Java Essentials,Java Programming...
# 2

I'm sorry for my posting my question under a worng Forum section. Next time I'll take care

Thank you for reply. I tried but I did not get solution.

divider.getcomponentCount()

gives me no :2

On leftside of splitPane I have JTree while on right side I'm playing movie as user select from the tree node.

So I want to resize the moviePanel when user click on oneTouchableExpandable button on divider.

But I have a problem in writtng Listener for button on divider.

I really appreciate your help.

Thank you,

Kirti

Message was edited by:

Kirti_Mistry

Kirti_Mistrya at 2007-7-11 22:28:01 > top of Java-index,Java Essentials,Java Programming...