test
test

Reputation: 18198

Java - JList see if ANYTHING is selected

How do I check if a user has anything selected inside a JList?

Upvotes: 2

Views: 8696

Answers (2)

Jon Skeet
Jon Skeet

Reputation: 1502036

Have you tried JList.isSelectionEmpty()?

Upvotes: 16

tpdi
tpdi

Reputation: 35171

It's not optimal, but...

Create a deep copy of the list before it gets changed. Then compare (using equals) the possibly changed list to the copy of the original.

Upvotes: 0

Related Questions