Hi,
I am using JList component and I add a vector of data by calling
list.setDataList( vec );
Then I fire up the dialog with the JList component in it, I would like
to hard-code it to highlight the very first data on the list, how can I
go about doing that?
Michael Rauscher - 13 May 2005 07:00 GMT
cybernerdsx2@yahoo.com schrieb:
> Hi,
>
[quoted text clipped - 4 lines]
> to hard-code it to highlight the very first data on the list, how can I
> go about doing that?
From the JList documentation:
<api>
public void setSelectedIndex(int index)
Selects a single cell.
</api>
Bye
Michael
Thomas Weidenfeller - 13 May 2005 08:00 GMT
> Then I fire up the dialog with the JList component in it, I would like
> to hard-code it to highlight the very first data on the list, how can I
> go about doing that?
Read the fine manual at
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JList.html#setSelectedIndex(int)
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
LDB - 15 May 2005 03:12 GMT
You can use
list.setSelectedIndex(0);
LDB
> Hi,
>
[quoted text clipped - 4 lines]
> to hard-code it to highlight the very first data on the list, how can I
> go about doing that?