aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTable MultipleRoW Selection Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable MultipleRoW Selection Problem" Watch "JTable MultipleRoW Selection Problem" New topic
Author

JTable MultipleRoW Selection Problem

bolloju bnm
Greenhorn

Joined: May 15, 2007
Posts: 11
Hi Friends,
I want to select multiple Rows in a JTable by holding down the CTRL Key .
In my application i am losing the previous selection like, If I select 2nd Row and by holding down the CTRL key if I select 6th Row, 2nd Row is getting deselected. If you have a solution please help me.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

Originally posted by bolloju bnm:
Hi Friends,
I want to select multiple Rows in a JTable by holding down the CTRL Key .
In my application i am losing the previous selection like, If I select 2nd Row and by holding down the CTRL key if I select 6th Row, 2nd Row is getting deselected. If you have a solution please help me.


Looks like your table has the ListSelectionModel.SINGLE_SELECTION as the selection model. You should be using the ListSelectionModel.MULTIPLE_INTERVAL_SELECTION (which is the default)


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
bolloju bnm
Greenhorn

Joined: May 15, 2007
Posts: 11
Thanks for your reply.
But my JTable is having MULTIPLE_INTERVAL_SELECTION as SelectionMode.With SHIFT key it is working fine.Problem is with CTRL Key only
bolloju bnm
Greenhorn

Joined: May 15, 2007
Posts: 11
Thanks for your reply.
But my JTable is having MULTIPLE_INTERVAL_SELECTION as SelectionMode.With SHIFT key it is working fine.Problem is with CTRL Key only
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

This indicates that it is SINGLE_INTERVAL_SELECTION. Can you please put a and confirm?
bolloju bnm
Greenhorn

Joined: May 15, 2007
Posts: 11
It is giving MULTIPLE_INTERVAL_SELECTION only
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

Do you have a custom table? Is there any place you have defined a selection model? Is there any place where you have tweaked the key bindings?

Can you post a short, self contained, correct example which reproduces your problem so we can take a look at it?

PS. I just noticed this.
"bolloju bnm" a.k.a mani.
Could you please adjust your screen name to comply to the Ranch Naming Policy?
Thank you.

[ October 06, 2008: Message edited by: Maneesh Godbole ]
[ October 06, 2008: Message edited by: Maneesh Godbole ]
 
jQuery in Action, 2nd edition
 
subject: JTable MultipleRoW Selection Problem