this is pretty basic I'm sure for most of you, but im having alot of trouble with the 2. Here is my code its BlueJ. Im sure this is simple for most of you, but im totally lost. Please try to explain to me what you did. here the code below. i know its messy but watever lol. Thanks for your help!
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Main
{
JFrame f1;
JPanel p1,p2;
GP g1;
JButton Bok,Bcc;
JTextField first,last,age,street,city,gender;
public Main()
{
String[] year = { "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008" , "2009", "2010"};
JComboBox yearcombo = new JComboBox(year);
yearcombo.setSelectedIndex(29);
yearcombo.addActionListener(actionEvent());
String[] month = { "January", "Febuary", "March", "April", "May", "June", "July", "October", "November", "December"};
JComboBox monthcombo = new JComboBox(month);
monthcombo.setSelectedIndex(9);
monthcombo.addActionListener(this);
String[] state = { "Alabama AL", "Alaska AK" ,"Arizona AZ", "Arkansas AR", "California CA" ,"Colorado CO", "Connecticut CT" ,"Delaware DE", "Florida FL","Georgia GA", "Hawaii HI"," Idaho ID","Illinois IL" ,"Indiana IN", "Iowa IA", "Kansas KS" ,"Kentucky KY" ,"Louisiana LA", "Maine ME", "Maryland MD" ,"Massachusetts MA", "Michigan MI" ,"Minnesota MN" ,"Mississippi MS" ,"Missouri MO", "Montana MT" ,"Nebraska NE", "Nevada NV" ,"New Hampshire NH" ,"New Jersey NJ", "New Mexico NM", "New York NY", "North Carolina NC", "North Dakota ND" ,"Ohio OH" ,"Oklahoma OK", "Oregon OR" ,"Pennsylvania PA" ,"Rhode Island RI", "South Carolina SC", "South Dakota SD" ,"Tennessee TN", "Texas TX" ,"Utah UT", "Vermont VT" ,"Virginia VA" ,"Washington WA", "West Virginia WV", "Wisconsin WI" ,"Wyoming WY"};
JComboBox statecombo = new JComboBox(state);
statecombo.setSelectedIndex(49);
statecombo.addActionListener(this);
String[] gender = {"M","F"};
JComboBox gendercombo = new JComboBox(gender);
gendercombo.setSelectedIndex(1);
gendercombo.addActionListener(this);
f1 = new JFrame("fafafffdas");
f1.setSize(832,669);
Container c1 = f1.getContentPane();
p1 = new JPanel();
p1.setSize(1000,730);
p1.setLayout(new BorderLayout());
first = new JTextField("First Name");
last = new JTextField("Last Name");
age = new JTextField("Age");
street = new JTextField("Street Address");
city = new JTextField("City");
clear = new JButton("Clear");
clear.addActionListener(new ButtonListener());
submit = new JButton("Submit");
submit.addActionListener(new ButtonListener());
Bok = new JButton("Save");
Bok.addActionListener(new ButtonListener());
Bcc = new JButton("Quit");
Bcc.addActionListener(new ButtonListener());
p2 = new JPanel(); //panel to add JLabel and TextField
g1 = new GP();
p1.add(g1,BorderLayout.CENTER);
g1.add(first);
g1.add(last);
g1.add(age);
g1.add(year);
g1.add(gender);
g1.add(street);
g1.add(city);
g1.add(state);
p2.add(submit);
p2.add(Bok);
p2.add(clear);
p2.add(Bcc);
p1.add(p2,BorderLayout.SOUTH); //adds p2 to south (Bottom) Graphics Panel will be added to Center
c1.add(p1);
f1.show();
}
public void actionPerformed(ActionEvent e)
{
JComboBox yearcombo = (JComboBox)e.getSource();
String year = (String)cb.getSelectedItem();
}
private class ButtonListener implements ActionListener
{
public void actionPerformed (ActionEvent event)
{
if (event.getSource() == clear)
{
}
if (event.getSource() == Bok)
{
g1.requestFocus();
}
if (event.getSource() == Bcc)
{
f1.dispose();
}
if (event.getSource() == submit)
{
}
g1.repaint();
}
}
}