import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class StudentForm extends JFrame {
Declaring the components
private JLabel nameLabel;
private JLabel idLabel;
private JLabel creditLabel;
private JLabel transferLabel;
private JLabel degreeLabel;
private JTextField nameField;
private JTextField idField;
private JTextField creditField;
private JCheckBox transferCheck;
private JSlider creditSlider;
private JComboBox degreeCombo;
private JButton addButton;
private JTextArea outputArea;
private JScrollPane outputPane;
Constructo
public StudentForm() {
XXXXXXXXXXsuper("Student Form");
XXXXXXXXXXsetSize(600,400);
XXXXXXXXXXsetDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Create the components
GUI Lab – CS 2323
Create a JFrame of size 600x400 input for a Student. The Student data class is provided.
It should have the JLabels shown with JTextField for Name (width 20) , ID(width 20), Credits (width 3). A
JCheckBox for Transfer, a JSlider tied to the Credits box with a major axis marks on every 10. There is a
JComboBox for the five degrees:
o "B.S. in Business Information Technology"
o "B.S. in Justice Administration"
o "B.T. in Applied Technology"
o "A.A. in Criminal Justice Studies"
o "A.A.S. in Applied Technology"
Down below is a JTextArea inside a ScrollPane. The user should be able to adjust the JSlider to change
the credits box
When the user presses the Add Student JButton, the data should be read from all the GUI and a new
Student created. The new Student’s toString() method should be called and the results appended to the
JTextArea:
Each time the button is pressed, a new student is added, the data fields should be rest to the defaults
Grading Criteria
Points Criteria
2 Create and Display Jform
2 Co
ect Layout
0.5 Name Field
0.5 ID Field
0.5 Transfer TextField
0.5 Credits TextField
0.5 Jslider for Credits
0.5 Major Combobox
0.5 JButton Add Student
0.5 ScrollPane with TextArea
2 Jslider changes Credits Field
2 Button Generates a Student from the GUI
2 new Student added to TextArea
2 Fields reset
4 Documentation