DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  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...

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links