?
Solved

Adding elements in AWT choice (Combo) boxes in Netbeans

Posted on 2004-09-13
14
Medium Priority
?
3,092 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 3
14 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 1000 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 1000 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
 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month8 days, 12 hours left to enroll

764 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