This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Single interval selection in two lists Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Single interval selection in two lists" Watch "Single interval selection in two lists" New topic
Author

Single interval selection in two lists

michael delta
Ranch Hand

Joined: Aug 11, 2009
Posts: 35
Hello, I have these Lists:



I add these lists on the same panel, moviesPane. How is it possible to be able select (or have highlighted) only one movie,dvd OR blueray?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8438

Listen to selection events. On selection call clearSelection() on the other list.


[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
michael delta
Ranch Hand

Joined: Aug 11, 2009
Posts: 35
Thank you for the response.

I did this:



Doesnt seem to work though...any ideas?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8438

Change to
michael delta
Ranch Hand

Joined: Aug 11, 2009
Posts: 35
I also had to write:

if(e.getSource()==dvdList.getSelectionModel())


Thank you so much for this!!
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8438

michael delta wrote:I also had to write:

if(e.getSource()==dvdList.getSelectionModel())


Well done
Shame on me. I did not notice it! Duh!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Single interval selection in two lists
 
Similar Threads
Next technology after DVD
not able to get the items from JList
Collections.sort() : need guidance for my code
Move implemenation out of main(String[ ] args)
How to add a String array to JList?