Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: JComboBox

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question JComboBox

    Hi all,

    A bit stuck with a problem I have to solve :

    Basically I have 2 ComboBoxes, each with 4 options ( say a,b,c,d).
    I also have a Button and a TextField on one window.

    I want the user to select an option from ComboBox1 (say a), then select a different option from ComboBox2 (say b), then click the button and a number (say 2.5) will appear in the text field. This number will be different for each combination of letters.

    I have managed to display it all as a GUI but not sure how to go about actually programming the options and relevant numbers.

    Thanks in advance for any help!


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: JComboBox

    Several options:

    1. A massive if statement
    2. Each option has a unique value. When they are added/multiplied it gives result you want to display
    3. Map

  3. #3
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: JComboBox

    Did you not like the advice you've already received elsewhere?

    This thread has been cross posted here:

    http://www.java-forums.org/new-java/42687-jcombobox.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting

    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. [SOLVED] Having Problem with my JComboBox
    By dazzl3r in forum What's Wrong With My Code?
    Replies: 4
    Last Post: December 9th, 2010, 12:03 AM
  2. [SOLVED] JCombobox help
    By sman36 in forum AWT / Java Swing
    Replies: 10
    Last Post: August 11th, 2010, 04:11 AM
  3. JComboBox
    By nasi in forum AWT / Java Swing
    Replies: 1
    Last Post: April 29th, 2010, 08:40 AM
  4. JComboBox and Textfield
    By Nexusfactor in forum AWT / Java Swing
    Replies: 3
    Last Post: November 9th, 2009, 12:57 PM
  5. JComboBox doubt
    By rajaramesh.tadi in forum AWT / Java Swing
    Replies: 0
    Last Post: August 24th, 2009, 08:18 AM