I need to make a scroll box that can contain an unknown number of elements. Namely it needs to be able to scroll. I'm not quite sure how to do this. Please help.
Asked
Active
Viewed 2,395 times
2

if_zero_equals_one
- 1,716
- 4
- 17
- 30
2 Answers
6
Use a JScrollPane with a JPanel wraped inside it. That way, you can add any number of elements to the JPanel without exceeding the panel's physical size using the JScrollPane.
Here is one part of the very famous oracle tutorial that explains the JScrollPane element: http://download.oracle.com/javase/tutorial/uiswing/components/scrollpane.html
I hope this helps!
4
You want to use a JList with a custom renderer.

Community
- 1
- 1

Reverend Gonzo
- 39,701
- 6
- 59
- 77
-
1table with one column, JList missed some usefull methods +1 – mKorbel Jul 15 '11 at 08:07