• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting index of a clicked column?? (wierd prob)

 
Don Burke
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Ive been having a problem return the index of the seleted column in a jtable. Ive tried a few things, including reading sun's doco on jtables but have not been able to solve the following bug.

If i click on a column, on its left side,..i get the correct column index.

If i click on the same column, on its right side..i get the index of the column next to it.

This is really wierd

this is the code..does neone know a solution to this? the elgant the better

cheers

 
Brian Cole
Author
Ranch Hand
Posts: 920
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code seems ok to me. What LnF are you using?
Is the table (and its header) in a JScrollPane?
Are you letting the table create its own header,
or are you doing something fancier?
 
Don Burke
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brian,

I'm using the default look and feel of java 1.5 -- i think its metal?

yep, the jtable and its header is wrapped in a JScrollpane

I have a class custom model that extends AbstractTableModel in which i set the columns there [no formatting is done, just the names as follows].



I think that i am letting the jtable construct its header, which i assume happens each time i assign a new instance of the above class as the model to the Jtable.

Am i missing something here mate? this has got me stumped.

cheers

Don
[ November 10, 2005: Message edited by: Don Burke ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!