Adding elements in AWT choice (Combo) boxes in Netbeans

What is the best way to add elements in AWT choice boxes in Netbeans IDE 3.6?

Thanks!
pkrushAsked:
Who is Participating?
 
TimYatesCommented:
choice.addItem( "new item" ) ;
0
 
pkrushAuthor Commented:
With the GIU designer?

Is using the GIU designer worth it?

Thanks again
0
 
TimYatesCommented:
Ahhh....

for adding the items into the list, I'd do that in code...  Not sure you can do it in the designer (I know you can't in JBuilder)

Use the designer for putting things where you want them, then the code for filling them up :-)

Tim
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
zzynxSoftware engineerCommented:
- Select the combo box
- in the properties press the button besides the item "Model"
- the rest should be clear :)
0
 
TimYatesCommented:
Can java.awt.Choice elements have a model?
0
 
zzynxSoftware engineerCommented:
>> in the properties
I mean

In the properties window press the browse ("...") button that is located besides the item "model" (within the "Properties" node)
0
 
zzynxSoftware engineerCommented:
Sorry, that was for JComboBox not for AWT choice boxes.
I think you simply can't in netBeans.
You'll have to code it yourself:

Choice ColorChooser = new Choice();
ColorChooser.add("Green");
ColorChooser.add("Red");
ColorChooser.add("Blue");
0
 
TimYatesCommented:
:-D
0
 
TimYatesCommented:
/me points to his previous answer ;-)
0
 
zzynxSoftware engineerCommented:
Remark:

addItem is obsolete as of Java 2 platform v1.1. Please use the add() method instead.
0
 
zzynxSoftware engineerCommented:
:°P  
hehehe ;°)
0
 
pkrushAuthor Commented:
Thank you both very much.
0
 
pkrushAuthor Commented:
If one was bent on using the GUI form designer (like me) they could just place the add statements to the post-init code as well. I just thought there would be a better way.
0
 
zzynxSoftware engineerCommented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.