Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable row and cell selection

 
aymane chetibi
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I 've had a problem and Ive been looking for a solution in vain for 1 month now. I would really appreciate your help.

In My JTable row CANNOT be selected. when you click somewhere on the table, only the cell on which you clicked get its borders blue.
I want the entire row to get selected whenever the user either right or left clicks on the table.

I know how to get the index of the row where the cursor of the mouse is, but this row doesn't want to get selected.

my cellrenderer look like this:



and my declaration look like this:


I would really appreciate your help PLEASEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEe!
regards
 
prashant gour
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try hands on

Table.changeSelection(row, col, true/false, true/false);

Table.setColumnSelectionAllowed(true/false);
Table.setRowSelectionAllowed(true/false);

this is method of JTable.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic