Resize JSplitPane Contanier

N

Naveen Bandhu

Hi all,

I want to resize the container which holds JSplitPane. The situation
is with right button pressed the container should be resized to the
size of left component of JSplitpane and with left button pressed
container should be expanded to the size of left component +
Jsplitpane + right component, unlike the default behaviour of
JSplitpane. How can i acheive this?

Thanks in advance.

Naveen.
 
B

Babu Kalakrishnan

[Followups set to c.l.j.gui]

Naveen said:
I want to resize the container which holds JSplitPane. The situation
is with right button pressed the container should be resized to the
size of left component of JSplitpane and with left button pressed
container should be expanded to the size of left component +
Jsplitpane + right component, unlike the default behaviour of
JSplitpane. How can i acheive this?

I'm afraid you'll have to be more clear in defining your problem for
others to understand it. Which "right" and "left" buttons are you
referring to ? The buttons of your mouse ?

Also your sentence "left component + JSplitPane + right component",
doesn't make too much sense since left and right components are *inside*
the JSplitPane, not outside in a separate container.

BK
 
N

Naveen Bandhu

Babu Kalakrishnan said:
[Followups set to c.l.j.gui]

Naveen said:
I want to resize the container which holds JSplitPane. The situation
is with right button pressed the container should be resized to the
size of left component of JSplitpane and with left button pressed
container should be expanded to the size of left component +
Jsplitpane + right component, unlike the default behaviour of
JSplitpane. How can i acheive this?

I'm afraid you'll have to be more clear in defining your problem for
others to understand it. Which "right" and "left" buttons are you
referring to ? The buttons of your mouse ?

Also your sentence "left component + JSplitPane + right component",
doesn't make too much sense since left and right components are *inside*
the JSplitPane, not outside in a separate container.

BK

Thanks for msg, by "buttons" im refering to "arrows" on JSplitPane and
"container" the window in which JSplitPane is displayed.

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.



thanks.
 
B

Babu Kalakrishnan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top