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 ?
posted 14 years ago
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.