Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MultipleCell Selection in JTable

 
Vrunda Joshi
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTable which is set individual cell selectable and allow multipleselection. I have a display problem when I use "CTRL" key and mouse toselect cells. The problem is that I cannot select them individually. (Someof Other cell are also selected) . Is it the
behaviour of JTable? And what can I do ?
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If you look at the JTable docs you'll see there's a getSelectedRows() and a getSelectedColumns() but not a getSelectedCells() method.
This is just an idea but why not try to set Row and Column selectionAllowed() to true and extend the JTable to return a series of (row, col) coords by adding them to a Vector using a mouseListener to detect each new (row,col) selection and storing it in a Vector.
A nice little idea would be to create a SelectedCell class that held a row,col pair of ints with that were set in the constructor and then had appropiate getXX() methods to be used later when you want to query the JTable about the cells that were selected.
Let us know how you get on.

Bye,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic