Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / August 2005

Tip: Looking for answers? Try searching our database.

Adding Elments to JComboBox

Thread view: 
fiqri - 31 Aug 2005 08:53 GMT
Hi All,

I am new to java gui. My requirement is to add elements to jcombobox
with respective values. For an example: I need to display servarl names
in the list if a list item selected a value or an id assigned to it
should out put.

in html i can do this

<select name=cmb>
<option value=100>Bird</option>
<option value=200>Cat</option>
<option value=300>Rabbit</option>
</select>

if you select "Bird" 100 is displayed

i need to accomplish this task using java and jcombobox.

please help on this.

thankx
Thomas Weidenfeller - 31 Aug 2005 09:06 GMT
> I am new to java gui. My requirement is to add elements to jcombobox
> with respective values.

Sun's tutorials are at

http://java.sun.com/docs/books/tutorial/uiswing/learn/index.html
http://java.sun.com/docs/books/tutorial/uiswing/index.html

Please read them. There are more pointers in the FAQ, yu might want to
read them, too.

/Thomas

Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

Roedy Green - 31 Aug 2005 11:31 GMT
>i need to accomplish this task using java and jcombobox.

see http://mindprod.com/jgloss/jcombobox.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Adin A - 31 Aug 2005 15:34 GMT
One way is:
String[] options = { "Bird", "Cat", "Rabbit" };
cmb = new JComboBox(options);

>Hi All,
>
[quoted text clipped - 18 lines]
>
>thankx


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.