JList Problems

T

Tom

Hi,

I have a JList with some String values in it and i have a ScrollPane tied
to the JList. Now the problem. When you have made a selection from the JList
i want to set my JList to the start value again but i cant get it to work.
I've tried with the JList methods: setSelectedIndex(int index), clearSelection(),
but nothing happends. So no i wonder how to set my JList to show the index
value i want?

Best Regards
Tom
 
D

Dave Roberts

Tom said:
Hi,

I have a JList with some String values in it and i have a ScrollPane tied
to the JList. Now the problem. When you have made a selection from the JList
i want to set my JList to the start value again but i cant get it to work.
I've tried with the JList methods: setSelectedIndex(int index), clearSelection(),
but nothing happends. So no i wonder how to set my JList to show the index
value i want?

Best Regards
Tom

Try ensureIndexIsVisible(int index) to set the viewport such that a
particular item in the list is visible.
 

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
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top