my dog learned polymorphism*
The moose likes Swing / AWT / SWT and the fly likes JComboBox in a JTable Cell Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JComboBox in a JTable Cell" Watch "JComboBox in a JTable Cell" New topic
Author

JComboBox in a JTable Cell

Sri Rangan
Ranch Hand

Joined: Dec 08, 2001
Posts: 160
I am using the following code to set the combobox editor in a JTable cell:

When I select a value on the cell first time, it is fine. And when I go to the next cell in the same column, right after the click on the cell, I get the previously selected value. How to avoid this?
Thanks
Sri
john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
can u tell us more about the data model that u passed to your JCombo
Sri Rangan
Ranch Hand

Joined: Dec 08, 2001
Posts: 160
Sorry for the delay in replying. I am using DefaultComboBoxModel.
Thanks
Sri
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
your code seems ok. the java bug database does not list any bugs that could cause your problem, but anyway: have you tried with different jdks? which jdk are you using?
cheers
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Hmmm... this is working fine for me... try out this example code and see what happens...



-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Sri Rangan
Ranch Hand

Joined: Dec 08, 2001
Posts: 160
Could you take a look at the code. I modifed your code to suit to my requirement.

I have to initially build the JTable with some empty rows and I populate the objects to comboboxmodel.
When I run this Once I select a value from combobox, I could not change it.
Thanks
Sri
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JComboBox in a JTable Cell
 
Similar Threads
jtable problem please help
JTable - URGENT !!!!
JTable and Combobox editor
Combobox in JTable
combobox rendered in a Jtable