if_zero_equals_one
if_zero_equals_one

Reputation: 1774

Scrollable Check Boxes

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.enter image description here

Upvotes: 2

Views: 2418

Answers (2)

Sam
Sam

Reputation: 2446

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!

Upvotes: 6

Reverend Gonzo
Reverend Gonzo

Reputation: 40811

You want to use a JList with a custom renderer.

Here's a similar question.

Upvotes: 4

Related Questions