Solved

Adding elements in AWT choice (Combo) boxes in Netbeans

Posted on 2004-09-13
14
2,838 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Groovy problem when using SOAPUI : DispatchException occurred 7 61
varialbe initialization 11 37
jsp insert to database example 2 47
jboss 7.1 start up error 1 42
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

821 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