• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JComboBox in a JTable Cell

 
Sri Rangan
Ranch Hand
Posts: 160
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 331
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can u tell us more about the data model that u passed to your JCombo
 
Sri Rangan
Ranch Hand
Posts: 160
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the delay in replying. I am using DefaultComboBoxModel.
Thanks
Sri
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm... this is working fine for me... try out this example code and see what happens...

 
Sri Rangan
Ranch Hand
Posts: 160
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic