This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Problem with JComboBox and JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Problem with JComboBox and JTable" Watch "Problem with JComboBox and JTable" New topic
Author

Problem with JComboBox and JTable

Murali Jaya Rao
Ranch Hand

Joined: Jun 10, 2007
Posts: 43
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

Joined: Sep 20, 2005
Posts: 852
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 ]

bitguru blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with JComboBox and JTable
 
Similar Threads
JTable and Combobox editor
JComboBOx in a Jtable
Combo in JTable
A JTable question
JTable - URGENT !!!!