|
-
Comboboxes to Radiobuttons
Here is part of an appelet, I would like to convert the comboboxes to radiobuttons with the first item of each radiogroup selected. I have tried numerous things but can't seem to get it right.
Any help would be appreciated.
Collin
import java.applet.Applet;
import java.awt.*;
import java.io.*;
public class teams extends Applet
{
public void init()
{
super.init();
setLayout(null);
resize(600, 500);
switch_key = true;
Font bigfont = new Font("TimesRoman", 1, 20);
Color backcolor = new Color(180, 210, 255);
Color groupcolor = new Color(255, 255, 255);
Color groupcolor2 = new Color(30, 255, 30);
Color color_white = new Color(255, 255, 255);
Color color_blue = new Color(0, 0, 255);
Color color_red = new Color(255, 0, 0);
Color color_green = new Color(0, 255, 0);
setBackground(backcolor);
label2 = new Label("A Team");
label2.setFont(bigfont);
add(label2);
label2.reshape(5, 0, 200, 24);
label3 = new Label("B Team");
label3.setFont(bigfont);
add(label3);
label3.reshape(255, 0, 550, 24);
pied_dad = new Choice();
pied_dad.addItem("Not Pied");
pied_dad.addItem("Pied");
pied_dad.setBackground(groupcolor);
add(pied_dad);
pied_dad.reshape(5, 160, 185, 20);
blue_dad = new Choice();
blue_dad.setBackground(groupcolor);
blue_dad.addItem("Not Blue");
blue_dad.addItem("Light Blue");
blue_dad.addItem("Split Light Blue");
blue_dad.addItem("Cobalt Blue");
blue_dad.addItem("Split Cobalt Blue");
blue_dad.addItem("Aquamarine");
add(blue_dad);
blue_dad.reshape(5, 40, 185, 20);
sexlink_dad = new Choice();
sexlink_dad.setBackground(groupcolor);
sexlink_dad.addItem("No Yellow");
sexlink_dad.addItem("Split Yellow");
sexlink_dad.addItem("Yellow");
sexlink_dad.addItem("Split Gold");
sexlink_dad.addItem("Gold");
sexlink_dad.addItem("Split Silver");
sexlink_dad.addItem("Silver");
sexlink_dad.addItem("Golden Silver");
sexlink_dad.addItem("Split Yellow + Split AmCinn");
sexlink_dad.addItem("Split AusCinn + Split AmCinn");
add(sexlink_dad);
sexlink_dad.reshape(5, 80, 185, 20);
pied_mom = new Choice();
pied_mom.addItem("Not Pied");
pied_mom.addItem("Pied");
pied_mom.setBackground(groupcolor);
add(pied_mom);
pied_mom.reshape(255, 160, 185, 20);
sexlink_mom = new Choice();
sexlink_mom.setBackground(groupcolor);
sexlink_mom.addItem("No Yellow");
sexlink_mom.addItem("Yellow");
sexlink_mom.addItem("Gold");
sexlink_mom.addItem("Silver");
add(sexlink_mom);
sexlink_mom.reshape(255, 80, 185, 20);
blue_mom = new Choice();
blue_mom.setBackground(groupcolor);
blue_mom.addItem("Not Blue");
blue_mom.addItem("Light Blue");
blue_mom.addItem("Split Light Blue");
blue_mom.addItem("Cobalt Blue");
blue_mom.addItem("Split Cobalt Blue");
blue_mom.addItem("Aquamarine");
add(blue_mom);
blue_mom.reshape(255, 40, 185, 20);
dark_dad = new Choice();
dark_dad.setBackground(groupcolor);
dark_dad.addItem("No Dark Factor");
dark_dad.addItem("Mid");
dark_dad.addItem("Full");
add(dark_dad);
dark_dad.reshape(5, 120, 185, 20);
dark_mom = new Choice();
dark_mom.setBackground(groupcolor);
dark_mom.addItem("No Dark Factor");
dark_mom.addItem("Mid");
dark_mom.addItem("Full");
add(dark_mom);
dark_mom.reshape(255, 120, 185, 20);
orange_ateam = new Choice();
orange_ateam.setBackground(groupcolor);
orange_ateam.addItem("Not Orange");
orange_ateam.addItem("Split Orange");
orange_ateam.addItem("Orange");
add(orange_ateam);
orange_ateam.reshape(5, 200, 185, 20);
orange_bteam = new Choice();
orange_bteam.setBackground(groupcolor);
orange_bteam.addItem("Not Orange");
orange_bteam.addItem("Split Orange");
orange_bteam.addItem("Orange");
add(orange_bteam);
orange_bteam.reshape(255, 200, 185, 20);
dv_dad = new Choice();
dv_dad.setBackground(groupcolor);
dv_dad.addItem("Not Lavender");
dv_dad.addItem("Mid Lavender)");
dv_dad.addItem("Full Lavender)");
add(dv_dad);
dv_dad.reshape(5, 240, 185, 20);
dv_mom = new Choice();
dv_mom.setBackground(groupcolor);
dv_mom.addItem("Not Lavender");
dv_mom.addItem("Mid Lavender)");
dv_mom.addItem("Full Lavender)");
add(dv_mom);
dv_mom.reshape(255, 240, 185, 20);
do_it = new Button("What Could I Get??");
do_it.setFont(new Font("Dialog", 1, 12));
add(do_it);
do_it.reshape(455, 40, 130, 50);
clear_form = new Button("Clear The Form");
clear_form.setFont(new Font("Dialog", 1, 12));
add(clear_form);
clear_form.reshape(455, 120, 130, 50);
male_sexlink = new List();
female_sexlink = new List();
sex = new List();
split_females = new List();
split_males = new List();
females = new List();
males = new List();
blue = new List();
darkfactor = new List();
piedfactor = new List();
orange = new List();
danish_violet = new List();
results = new List(10, false);
results.setBackground(color_white);
add(results);
results.preferredSize();
results.reshape(20, 305, 560, 175);
results.addItem("Enter Colors above.");
results.addItem("Press Results");
results.reshape(20, 305, 560, 175);
label4 = new Label("Instructions:");
add(label4);
label4.reshape(20, 285, 560, 20);
}
public boolean handleEvent(Event event)
{
if(event.id == 1001 && event.target == do_it)
{
clicked_do_it();
return true;
}
if(event.id == 1001 && event.target == clear_form)
{
clicked_clear_form();
return true;
} else
{
return super.handleEvent(event);
}
}
public void clicked_do_it()
{
results.clear();
sex.clear();
males.clear();
females.clear();
split_males.clear();
split_females.clear();
blue.clear();
male_sexlink.clear();
female_sexlink.clear();
darkfactor.clear();
piedfactor.clear();
orange.clear();
danish_violet.clear();
switch(dark_dad.getSelectedIndex())
Collin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks