Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Programatically Select an Item in a JList

807607Oct 20 2006 — edited Oct 20 2006
Hi,
I need to do this: Programmatically select an item in a JList.


JList.selectItem(0) will select the item 0 in the model but it will NOT visually highlight the selected item in the list.
Neither will ensureIndexIsVisible(0),

I need to automatically select and item in a list (highlight that item as well)
As if someone has clicked on that item with the mouse.. however they haven't you see, my program has done it, programatically.

Please don't refer me to the beginners guide to java, or the API documentation, the answer is not there.

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 17 2006
Added on Oct 20 2006
4 comments
1,150 views