• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Selecting a row in JTable

 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i have this problem,

When i select a row in my JTable, the full row is not getting highlighted as in MS-Excel.

Kindly provide your help.
I wrote the following code:
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Kindly provide your help.

the snippet you posted works OK for me (1.5.0_05)
 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Thanks for the reply...

But there is a problem.If you select row 1 from column 1, it will select the first row.

But if you select row 1 from column 2, first row will be selected except that column. This should not happen.

When we welect row 200 from column 1, only row 200 should be selected. (Just like MS-Excel)

When we select row 200 from column 2, only that cell should be highlighted not the full row.

Kindly post your reply. This is required on an urgent basis.
Thanks, Vijay
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I'm lost.

selecting any cell, regardless of column, highlights the entire row.

but this is not like excel (Excel 2000, anyway) - to select the entire row
you need to click the row header.

from your description you would need to use a custom cellRenderer
 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks for your input.
I have solved the problem.
But one more problem has arised.
I select a row and it gets highlighted. After this i invoke a Find/Replace function.

When i click Find Next button without entering any data in Find text box, the cell selection toggles in all cells but the background color of the cells is not getting changed as in Excel

How to change that? Kindly reply
Thanks
[ February 06, 2007: Message edited by: vijaychandran rajagopalan ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic