• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic