Solved

Adding elements in AWT choice (Combo) boxes in Netbeans

Posted on 2004-09-13
14
2,932 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 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
web application structure 18 135
maven module vs maven project 3 113
using executorService 3 19
Overriding a method 3 7
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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…
Suggested Courses

732 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