JCOMBOBOX - how to get the options?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: JCOMBOBOX - how to get the options?

  1. #1
    Join Date
    Jun 2003
    Posts
    4

    Unhappy JCOMBOBOX - how to get the options?

    Hey, I`m pretty new with java, and i want to use comboboxes... that goes well, but i want to "read" the option the user selected.

    Say we have 6 options
    - one
    - two
    - three
    - four
    - five
    - six

    And the user has selected the 3d one: three, how can i get that "three" in a string?

    String UsersChoice = "";
    Userschoice = getItem("dont know what must stand here...?");

    something like this???
    This must be easy, but if you can help me.... thanx!

    Wouter
    w_koppers@hotmail.com

  2. #2
    Join Date
    Jun 2003
    Posts
    8
    Well...it indeed is easy...

    You are on the right track. What you need to do is the following

    String UsersChoice = "";
    Userschoice = ChoiceName.getItem( i );

    Replace ChoiseName with the name of your box

    i is de index number of the box. You have six options so the index will go from 0 to 5. (just like in an array).

    I hope this is explains all.

  3. #3
    Join Date
    Jun 2003
    Posts
    4

    Thumbs up

    ****, that Is easy....

    Ok, thanx for the help.... hope i can do the rest now...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center