Click to See Complete Forum and Search --> : JPanel with scroll bar


burung
07-22-2005, 06:56 PM
Hi,

I plan to create dynamic JPanel with a scroll bar. I have a restricted JPanel to accomodate all the components that can be added dynamically into the panel.

I have look at JScrollPane but it just for textArea and image.

What should I do?
:confused: :confused:

evlich
07-22-2005, 10:30 PM
You should just be able to add the JPanel to the JScrollPane the same way that you add any other component to it. For example:

JPanel panel = new JPanel();
JScrollPane scrollpane = new JScrollPane(panel);

When the panel resizes, the scrollbars should adjust to accomodate the changes.

Hope this helps.

sjalle
07-23-2005, 08:29 AM
Also, if you try a JList for displaying, you could have a look at the methods for
implementing your own listrenderer.

burung
07-25-2005, 08:59 AM
Thank you very much evlich and sjalle.

I've did it using JScrollPane. You are right evlich.
Actually JScrollPane accepts all kind of components.