// Event listening
public void actionPerformed(ActionEvent e)
{
// If the input button is pressed
if (e.getSource() == insert)
{
Student student = Student.getInstance();
// Get text in the text box
getAllInputs(student);
// Check if all of them have been entered
if (!isInputAll(student))
{
JOptionPane.showMessageDialog(this, "Please fill in all inputs");
} else
{
// judge
if (canBeInsert())
{
insetIntoStudent(student);
JOptionPane.showMessageDialog(this, "Entered successfully!", "Information Management System",
JOptionPane.INFORMATION_MESSAGE);
}
}
}
// If the reset button is pressed
else if (e.getSource() == reset)
{
// Clear all input boxes
cleanInput();
}
}