This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTable row and cell selection 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 "JTable row and cell selection " Watch "JTable row and cell selection " New topic
Author

JTable row and cell selection

aymane chetibi
Ranch Hand

Joined: Apr 12, 2006
Posts: 175
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

Joined: Feb 07, 2006
Posts: 45
try hands on

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

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

this is method of JTable.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JTable row and cell selection
 
Similar Threads
Switch Selection between 2 JTable?
Problem with JTable
How to change the colour of an JTable Cell dynamically
JTable selection problem
Please Help! JTable and TableCellRenderer color problem