Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JList problem.

Reply
Thread Tools

JList problem.

 
 
Tom
Guest
Posts: n/a
 
      07-29-2003

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
 
Reply With Quote
 
 
 
 
Ike
Guest
Posts: n/a
 
      07-30-2003
I think you need to work with a ListModel. Create a list model to add the
data to, then create the JList to display the list:

listmodel_1=new DefaultListModel();
jList1=new JList(listmodel_1);

you may be able to just get the list model from your already data-populated
JList, and set teh selected index on that. -Ike

"Tom" <(E-Mail Removed)> wrote in message
news:3f26fe72$0$7161$(E-Mail Removed). be...
>
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: JList customized with TreeSet Sandip Chitale Java 0 08-23-2003 09:44 PM
Getting the previously selected index for JList Jared Java 0 07-31-2003 07:39 AM
JList Problems Tom Java 1 07-30-2003 03:15 PM
JList question - how to fire a change event when nothing has changed? Sam Java 0 07-17-2003 10:40 PM
JList question Passero Java 1 06-28-2003 12:17 PM



Advertisments