-
How to use a JList?
I have books that don't mention it, sample code that doesn't compile, and more sample code that does fancy tricks but not illustrate the basics.
Maybe I'm dumb, but the one thing I can't seem to figure out is how to just double click on something in a JList and make it do something. I have a list that is created and added to a window in response to user input, and I can't get anything out of it.
Can anyone provide beginning-to-end sample code to do that, or point to a good tutorial? I would appreciate it.
-
Did you look it up in the documentation?
-
getSelectedIndex()
Returns the smallest selected cell index; the selection when only a single item is selected in the list.
add mouselistener to detect double click
-
Is it the right place for your thread JList?
Absolutely Not.
If You post this ques under Swing category ,you can get plenty response.