-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
1.1.6, 1.2.0
-
x86
-
windows_nt
Name: rm29839 Date: 06/10/98
I would like to be able to have a JSplitPane call
its resetToPreferredSizes() method if the user double clicks on the divider. This feature could be an option, like
setOneTouchExpandable().
I tried adding a MouseAdapter to implement this feature, but I ran into a couple of problems:
1) If I add the MouseAdapter to the JSplitPane,
the adapter only responds to a very narrow
portion of the divider.
2) If I add the MouseAdapter to the divider
(to which there is no convenient access)
I am no longer able to drag the divider.
I used the following code to add the adapter to
the divider.
try {
Component divider =
((java.awt.swing.plaf.basic.BasicSplitPaneUI)
fSplitPane.getUI()).getDivider();
divider.addMouseListener (new MouseAdapter() {
public void mouseClicked (MouseEvent event)
{
if (event.getClickCount() == 2) {
fSplitPane.resetToPreferredSizes();
repaint(); // This shouldn't be necessary!
} // if
} // mouseClicked
});
} catch (ClassCastException e) {}
(Review ID: 33435)
======================================================================