Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with JComboBox and JTable  RSS feed

 
Murali Jaya Rao
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a JTable in that 2 columns are JComboBox and rest are normal text fields.

My requirement is if i select first comboBox the second should automatically reflected.

I have tried writing the actionPerfomed() method for both but when i click the combobox coloumn jtable returned the row -1.

Suggest any ideas.

Thanks,
Murlai.
 
Brian Cole
Author
Ranch Hand
Posts: 935
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Murali Jaya Rao:
I have a JTable in that 2 columns are JComboBox and rest are normal text fields.

My requirement is if i select first comboBox the second should automatically reflected.

I have tried writing the actionPerfomed() method for both but when i click the combobox coloumn jtable returned the row -1.


The place for this is in your table model's setValueAt() method.

Set values for both columns and call fireTableRowsUpdated(row, row).
[ November 13, 2008: Message edited by: Brian Cole ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!