I dont know how to add a next button that will continue to a next page.
The next page will have:
Prelim Exam Grade
Midterm Exam Grade
Final Exam Grade
Compute Button
Exit Button
Here is the code i have done.
HELP ME PLEASE. THANKS.
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class Grade extends JFrame
{
private JLabel lastnameL, firstnameL, middlenameL, studentnoL, courseL;
private JTextField lastnameTF, firstnameTF, middlenameTF, studentnoTF;
private JComboBox courseCB;
private static final String[] courseList =
{
"BS Information Technology",
"BS Computer Science"
};
private JButton continueB, exitB;
private ExitButtonHandler ebHandler;
public Grade()
{
lastnameL = new JLabel("Last Name:", SwingConstants.LEFT);
firstnameL = new JLabel("First Name:", SwingConstants.LEFT);
middlenameL = new JLabel("Middle Name:", SwingConstants.LEFT);
studentnoL = new JLabel("Student Number:", SwingConstants.LEFT);
courseL = new JLabel("Course:", SwingConstants.LEFT);
lastnameTF = new JTextField(10);
firstnameTF = new JTextField(10);
middlenameTF = new JTextField(10);
studentnoTF = new JTextField(10);
courseCB = new JComboBox(courseList);
continueB = new JButton("Continue");
exitB = new JButton("Exit");
ebHandler = new ExitButtonHandler();
exitB.addActionListener(ebHandler);
setTitle("Grades");
Container pane;
pane = getContentPane();
pane.setLayout(new GridLayout(6,2));
pane.add(lastnameL);
pane.add(lastnameTF);
pane.add(firstnameL);
pane.add(firstnameTF);
pane.add(middlenameL);
pane.add(middlenameTF);
pane.add(studentnoL);
pane.add(studentnoTF);
pane.add(courseL);
pane.add(courseCB);
pane.add(continueB);
pane.add(exitB);
setSize(300,200);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
private class ExitButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
}
public static void main(String[] args)
{
Grade newGrade = new Grade();
}
}