import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Gui extends JFrame implements ActionListener {
Store StudentStore = new Store(200);
public static void main(String[] args)
{
JFrame frame = new JFrame("Test");
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
JPanel panel2 = new JPanel(new GridBagLayout());
frame.getContentPane().add(panel2, BorderLayout.NORTH);
GridBagConstraints d = new GridBagConstraints();
}
public Gui() {
JFrame frame = new JFrame("Test");
frame.setSize(500,500);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel2 = new JPanel(new GridBagLayout());
frame.getContentPane().add(panel2, BorderLayout.NORTH);
GridBagConstraints d = new GridBagConstraints();
JLabel label1 = new JLabel("Please Enter Student Detailes Below");
d.gridx = 0;
d.gridy = 0;
d.insets = new Insets(5, 5, 5, 5);
panel2.add(label1, d);
/*JPanel panel3 = new JPanel(new GridBagLayout());
frame.getContentPane().add(panel3, BorderLayout.CENTER);
GridBagConstraints b = new GridBagConstraints();*/
/*JPanel panel4 = new JPanel(new GridBagLayout());
frame.getContentPane().add(panel4, BorderLayout.EAST);
GridBagConstraints h = new GridBagConstraints();*/
JPanel panel1 = new JPanel(new GridBagLayout());
frame.getContentPane().add(panel1, BorderLayout.WEST);
GridBagConstraints c = new GridBagConstraints();
JLabel label2 = new JLabel("Enter Name:");
c.gridx = 0;
c.gridy = 0;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(label2, c);
JTextField eName = new JTextField(15);
c.gridx = 1;
c.gridy = 0;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(eName);
JLabel label3 = new JLabel("Select Gender:");
c.gridx = 0;
c.gridy = 1;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(label3, c);
JRadioButton maleButton = new JRadioButton("Male");
c.gridx = 1;
c.gridy = 1;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(maleButton, c);
JRadioButton fmaleButton = new JRadioButton("Female");
c.gridx = 2;
c.gridy = 1;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(fmaleButton, c);
JLabel label4 = new JLabel("Select Date of Birth:");
c.gridx = 0;
c.gridy = 2;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(label4, c);
JLabel label5 = new JLabel("Enter Email Address:");
c.gridx = 0;
c.gridy = 3;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(label5, c);
JTextField eMail = new JTextField(15);
c.gridx = 1;
c.gridy = 3;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(eMail, c);
JLabel label6 = new JLabel("Enter Student Number:");
c.gridx = 0;
c.gridy = 4;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(label6, c);
JTextField stuNum = new JTextField(15);
c.gridx = 1;
c.gridy = 4;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(stuNum, c);
JLabel label7 = new JLabel("Select Enrolment Date:");
c.gridx = 0;
c.gridy = 5;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(label7, c);
JLabel label8 = new JLabel("Enter Course Name:");
c.gridx = 0;
c.gridy = 6;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(label8, c);
JTextField courseName = new JTextField(15);
c.gridx = 1;
c.gridy = 6;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(courseName, c);
JLabel label9 = new JLabel("Enter Year/Level:");
c.gridx = 0;
c.gridy = 7;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(label9, c);
JTextField eYear = new JTextField(15);
c.gridx = 1;
c.gridy = 7;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(eYear, c);
String[] dateString = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" };
String[] monthString = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
String[] yearString = {"1970", "1971", "1972", "1973","1974", "1975", "1976", "1977", "1978", "1979", "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", "2011", "2012" };
JComboBox dateList = new JComboBox(dateString);
c.gridx = 1;
c.gridy = 2;
panel1.add(dateList, c);
JComboBox monthList = new JComboBox(monthString);
c.gridx = 2;
c.gridy = 2;
panel1.add(monthList, c);
JComboBox yearList = new JComboBox(yearString);
c.gridx = 3;
c.gridy = 2;
panel1.add(yearList, c);
String[] dateEString = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" };
String[] monthEString = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
String[] yearEString = {"1970", "1971", "1972", "1973","1974", "1975", "1976", "1977", "1978", "1979", "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", "2011", "2012" };
JComboBox dateEList = new JComboBox(dateEString);
c.gridx = 1;
c.gridy = 5;
panel1.add(dateEList, c);
JComboBox monthEList = new JComboBox(monthEString);
c.gridx = 2;
c.gridy = 5;
panel1.add(monthEList, c);
JComboBox yearEList = new JComboBox(yearEString);
c.gridx = 3;
c.gridy = 5;
panel1.add(yearEList, c);
JButton enter = new JButton("Enter");
c.gridx = 1;
c.gridy = 8;
c.insets = new Insets(5, 5, 5, 5);
enter.addActionListener(this);
panel1.add(enter, c);
JButton wipe = new JButton("Clear");
wipe.addActionListener(this);
c.gridx = 2;
c.gridy = 8;
c.insets = new Insets(5, 5, 5, 5);
panel1.add(wipe, c);
JMenuBar menubar = new JMenuBar();
frame.setJMenuBar(menubar);
JMenu file = new JMenu("File");
menubar.add(file);
JMenuItem New = new JMenuItem("New");
JMenuItem save = new JMenuItem("Save");
JMenuItem open = new JMenuItem("Open");
file.add(New);
file.add(save);
file.add(open);
JMenu record = new JMenu("Record");
menubar.add(record);
JMenuItem add = new JMenuItem("Add");
JMenuItem display = new JMenuItem("Display");
JMenuItem clear = new JMenuItem("Clear");
record.add(add);
record.add(display);
record.add(clear);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == wipe)
{
addStudent();
}
if (e.getSource() == enter){
}
}
}