• 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

About JComboBox and JRadioButton

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, guys


I made a small program in wich when I select the one of the items in the combobox an image will appeare on the jlabel 1 on the right.
there are 2 JRadioButtons on the buttom of the JFrame and when i click one of the radiobuttons it will display the value of the image on jlabel 2.

when the second radiobutton is clicked, it will display another value about the image on the jlabel 3 .
but the problem is when I select the second item in the combobox it will still display the old value of firts item on jlabel 2 and 3 .

the question is how can I make it come to the default value automatically ( example: 0; ) when i select second item in the combobox.

thanks.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you discovered the Oracle tutorials? There's a section on Handling Events on a Combo Box.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

the question is how can I make it come to the default value automatically ( example: 0; ) when i select second item in the combobox.



You need to invoke the code that is executed when you click on the radio button. That is every time you select an item from the combo box you need to do two things:

1) update the image
2) query the radio button to determine which one is selected and then display the data related to that radio button.

Also, quit cross posting questions: http://stackoverflow.com/questions/29677098/about-jcombobox-and-jradiobutton. Its annoying when you spend time answering a question only to find out it was answered somewhere else.
 
Latif Hemid
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Also, quit cross posting questions: http://stackoverflow.com/questions/29677098/about-jcombobox-and-jradiobutton. Its annoying when you spend time answering a question only to find out it was answered somewhere else.



Hi,
İ am really sorry for that i did not mean it. i just wanted to get advice as soon as possible be cause of the time difference.
i finally did it.

Thanks everyone in here.
 
reply
    Bookmark Topic Watch Topic
  • New Topic