• 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

Get trouble in JComboBox

 
Ranch Hand
Posts: 570
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have three JComboBox and implemented with addActionListener.

Firstly, they need to click the item in MovieTitle, then the MovieDay item will be displayed based on the item selected in MovieTitle. (Ignore the MovieTime comboBox ) I did a small test here but the printed output looked weird.


Below are the output printed.

For first time, when I select "The Angry bird" (movie title), it display the day items correctly. When I select the day items , the output which is movieTitle display correctly.
However, when I select another movie again, example "ABC", it display two times "Angry bird" even I not yet select the day items, but the day items display in JComboBox correctly !!!
Capture.PNG
[Thumbnail for Capture.PNG]
 
Bartender
Posts: 732
10
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Every time you click on combo1 you are adding another ActionListener to it. You should add one and only one action listener, when you create combo1. And dpon't create a combobox in the actionPerformed method of the first combobox. Create all three of the combo boxes at the same time.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic