jQuery in Action, 3rd edition
The moose likes Swing / AWT / SWT and the fly likes Very Urgent---JComboBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Very Urgent---JComboBox" Watch "Very Urgent---JComboBox" New topic

Very Urgent---JComboBox

narayana satish

Joined: Dec 21, 2000
Posts: 25
In order to add items to the JComboBox we are creating a string and adding the items through that. But how to add the items at Run Time. Please help me out it is very urgent
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

When you write
...we are creating a string and adding the items through that

Does the string get added to a JComboBox the moment after you type the code, or does it happen when you run the program?

Everything in Java happens at Run Time (as opposed to say VB which offers the dubious advantages of "Design Time")

The shorter answer for you is: The same way.

A more thoughtful answer: look in the API, under JComboBox, there is an addItem(Object obj) method, and remember that Strings are objects.

[This message has been edited by Mike Curwen (edited March 30, 2001).]
I agree. Here's the link: http://aspose.com/file-tools
subject: Very Urgent---JComboBox
It's not a secret anymore!