Solved

Adding elements in AWT choice (Combo) boxes in Netbeans

Posted on 2004-09-13
14
2,670 Views
Last Modified: 2008-01-16
What is the best way to add elements in AWT choice boxes in Netbeans IDE 3.6?

Thanks!
0
Comment
Question by:pkrush
  • 6
  • 5
  • 3
14 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 250 total points
ID: 12043762
choice.addItem( "new item" ) ;
0
 

Author Comment

by:pkrush
ID: 12043787
With the GIU designer?

Is using the GIU designer worth it?

Thanks again
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12043813
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
 
LVL 37

Expert Comment

by:zzynx
ID: 12043873
- Select the combo box
- in the properties press the button besides the item "Model"
- the rest should be clear :)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12043885
Can java.awt.Choice elements have a model?
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12043901
>> 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
 
LVL 37

Assisted Solution

by:zzynx
zzynx earned 250 total points
ID: 12044034
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 35

Expert Comment

by:TimYates
ID: 12044044
:-D
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12044047
/me points to his previous answer ;-)
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12044049
Remark:

addItem is obsolete as of Java 2 platform v1.1. Please use the add() method instead.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12044061
:°P  
hehehe ;°)
0
 

Author Comment

by:pkrush
ID: 12046069
Thank you both very much.
0
 

Author Comment

by:pkrush
ID: 12046259
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
 
LVL 37

Expert Comment

by:zzynx
ID: 12051715
Thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sumDigits  challenge 7 61
noX challenge 17 76
topping3 challenge 14 51
JAVA part two 5 41
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now