Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    2 drop downs based on radio choice

    Hi guys, hope you are well.

    I am trying to get a menu to alter the drop down values, depending on the radio button choice.

    Radio buttons are : Buy or Rent
    Drop down Values are :

    Buy - 1,2,3,4,5
    Rent - 1pw,2pw,3pw,4pw,5pw

    Im struggling a little bit, any help would be great!

    Many thanks

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    http://docs.oracle.com/javase/tutori...ml#radiobutton

    In your event listener, you need to swap the model for the JComboBox that you are needing to change the values for. Simply call the .setModel and provide it with a new ComboBoxModel object to display. If you use the DefaultComboBoxModel, you can provide it with an Object[] or a Vector to items.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •