> I made a JTable object named tabel And set one of its columns with
> JComboBox as CellEditor. When mouse clicked on the JComboBox cell,
> code "table.getSelectedRow()" returns -1, and not return the row
> number until I selected one of the JComboBox's items. What Wrong?
Sounds like you test the value before the row is actually selected in
the model.
> Now I want to get the row number with "table.getSelectRow" while
> clicked on the JComboBox cell immediately, how can I do?
You need to "wait" until the model has been updated. Where do you call
getSelectedRow() in your code? If you use a custom CellEditor, use the
passed row index in getTableCellEditorComponent().
MaoXuePeng - 10 Oct 2004 02:08 GMT
> Where do you call getSelectedRow() in your code?
I call getSelectedRow in the function "actionPerformed(ActionEvent event)"
of the JComboBox.
The problem is : When clicked on the JComboBox column, then fired a action
event, but the "getSelectedRow()" returns -1.
> Sounds like you test the value before the row is actually > selected in
the model.
You mean When clicked on the JComboBox column, the table model didn't know
a row was selected? But, actually, there is a row in the table was
selected.
How can I get the row number when click on the JComboBox column by
"getSelectedRow()" in the "actionPerformed()" function?
Thanks!
MaoXuePeng.
> I made a JTable object named tabel And set one of its columns with
> JComboBox as CellEditor. When mouse clicked on the JComboBox cell, code
[quoted text clipped - 3 lines]
> Now I want to get the row number with "table.getSelectRow" while clicked
> on the JComboBox cell immediately, how can I do?
Please post compilable code that clarifies what you want to do.
Christian

Signature
And in short, I was afraid.