wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Single interval selection in two lists Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
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: 10170
    
    8

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


[How to ask questions] [Donate a pint, save a life!] [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: 10170
    
    8

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: 10170
    
    8

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://aspose.com/file-tools
 
subject: Single interval selection in two lists
 
Similar Threads
Next technology after DVD
Move implemenation out of main(String[ ] args)
Collections.sort() : need guidance for my code
How to add a String array to JList?
not able to get the items from JList