tags:

views:

46

answers:

1

Is there a way to see if my JList list is being selected or not?

I say this because I have a JList and JTextfield and when I type "F" in the JList to do a keyevent action.. the letter F gets typed into the JTextField after I focus on it.

For example: Let's say I go to JTextField and type "hi". I go back to my JList and click on selected item and press "F" to delete that from list... well then in JTextField... I would also type "F" even though I am on JList.

Get what I am saying?

+1  A: 

Use getSelectedIndex() or isSelectionEmpty() function of the JList.

walters