• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Very Urgent---JComboBox

 
narayana satish
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic