| Author |
Deselection of Items in a JList
|
Gregg Bolinger
Sheriff
Joined: Jul 11, 2001
Posts: 15040
|
|
I have a JList of Users and a Refresh Button. When the refresh button is hit, I need the getSelectedItem to become null again instead of a value. Can someone tell me how? Thanks ------------------ Happy Coding, Gregg Bolinger
|
My Blog | DZone Articles
|
 |
Matt Senecal
Ranch Hand
Joined: Dec 01, 2000
Posts: 255
|
|
When the refresh button is pressed, why not do a JList.setSelectedValue(null, false)?
Originally posted by Gregg Bolinger: I have a JList of Users and a Refresh Button. When the refresh button is hit, I need the getSelectedItem to become null again instead of a value. Can someone tell me how? Thanks
|
There's nothing more dangerous than a resourceful idiot. ---Dilbert
|
 |
Gregg Bolinger
Sheriff
Joined: Jul 11, 2001
Posts: 15040
|
|
Cool, I think it works., But let me ask you this. How do you get the selection to go away. Say I select the 1st name, then I click a refresh button, the item in the list still appears to be selected. I want it to become unselected. Thanks ------------------ Happy Coding, Gregg Bolinger
|
 |
Matt Senecal
Ranch Hand
Joined: Dec 01, 2000
Posts: 255
|
|
I think JList.clearSelection() does that.
Originally posted by Gregg Bolinger: Cool, I think it works., But let me ask you this. How do you get the selection to go away. Say I select the 1st name, then I click a refresh button, the item in the list still appears to be selected. I want it to become unselected. Thanks
|
 |
Gregg Bolinger
Sheriff
Joined: Jul 11, 2001
Posts: 15040
|
|
You the man Matt. Thanks a mil!! ------------------ Happy Coding, Gregg Bolinger
|
 |
 |
|
|
subject: Deselection of Items in a JList
|
|
|