Add a scrollbar to the rightside of a splitpane

  • Thread starter Maarten via JavaKB.com
  • Start date
M

Maarten via JavaKB.com

I've got a JSplitpane containing a TreePanel on the left and a JPanel containing several buttons and labels on right.

When resizing the window, no scrollbars are added the the right-side!

Can anyone help (with code-example)
 
P

Paul

A simple way for me is to just put the panel in a javax.swing.JScrollPane.
So where you have
container.add(panel);
use
container.add(new JScrollPane(panel));

It will add horizontal and vertical scrollbars, however, so if you only want
one you will have to do something else.
--Paul
 
S

Steve W. Jackson

Maarten via JavaKB.com said:
I've got a JSplitpane containing a TreePanel on the left and a JPanel
containing several buttons and labels on right.

When resizing the window, no scrollbars are added the the right-side!

Can anyone help (with code-example)

<http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.ht
ml>

That page gives a good view of how scroll panes work. The essential
thing is to set the size of the client -- that is, the component placed
inside the scroll pane.

= Steve =
 

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

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,691
Members
48,796
Latest member
Greg L.

Latest Threads

Top