Naveen said:
Thanks for msg, by "buttons" im refering to "arrows" on JSplitPane and
"container" the window in which JSplitPane is displayed.
OK - the onetouch expansion buttons you mean. It is virtually impossible
to write an event handler for them without writing your own UI delegate
for the JSplitpane. Also if you read the API docs, you'll notice that it
says that even the availability of one touch expansion buttons is Look
and Feel dependant - so you may not even have these buttons present in
certain look and feels.
anyway let me rephrase.. I want to accomplish a "docking window"
effect. I want to be able to click on a JSplitPane and have it resize
the Window. For eg: I want to have a window which contains 2 panels.
The left panel should always be displayed. When the user clicks on the
JSplitPane arrow the right panel is displayed and the window increases
in size to display a right panel. When the user clicks on the
JSplitpane arrow again the right panel disappears and the window
resizes to its original size.
If all you want is the button actions (and not the user draggability of
the splitpane divider), i'd say it would be a lot simpler to not use the
JSplitPane at all and write your own custom panels / custom buttons
which will do exactly what you want. If you want the user to be able to
drag the divider as well, the task is a a little more difficult. Look at
the source code of javax.swing.plaf.basic.BasicSplitPaneUI and
BasicSplitPaneDividerUI classes to see what is involved.
By the way, it is easier for other users to understand your problem if
you stick to standard terminologies. The bar in the middle of a
JSplitPane is the "divider" (and the buttons are termed
one-touch-expansion buttons). "JSplitpane" means the whole container
including the left/right panels (where your left/right or top/bottom
components are places) and the divider.
BK