• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JCombobox in JTable cell does not dropdown

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My JTable contains two columns, the 2nd column contains an extended JCombobox. The problem appears when the table contains multiple rows. When the table is displayed and I click on one of the Comboboxs it drops down as it should and I make a selection. I then click on another Combobox and the combobox is highlighted but the selection list does not drop down. I must click on it a 2nd time to make it drop down. Not sure how to resolve this one???
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that possbily I know the reason for this, but not the solution. The reason I think is because the first time you click the Cell containing the JComboBox, you are simply selecting the Cell, then you are able to click the JComboBox.
So hopefully someone knows why this is.
 
Rob Elliott
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem was that stopcellediting was not being called until the 2nd combobox was clicked, probably invoked by lostfocus. The solution was to implement ItemLister interface in my custum editor class (derived from DefaultCellEditor), and the ItemListener to the private Combobox member and in teh ItemStateChanged handler call stopCellEditing.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic