Add another class called StudentAED class that stores the me
Add another class called StudentAED class that stores the methods for an Add button, Edit button, and Delete button to the Gui Bellow. Please Show code when done, thank you.[][][][][][][][][][][][][][][][][][]][][][][]][][][][][][]][]][][][][][][][][][][][][][][][][][][][][][][][][][][]][][]][][][][][][][][][][][][][][][][][][]][][][][][][][][][][][][]][][][][][][][][][][][][][][][[][][]][[][[][][][][][][[]][[][][][][]
public class Student {
private String studentID;
private String studentEmail;
private String studentFirstName;
private String studentLastName;
/**
* @param studentID
* @param studentEmail
* @param studentFirstName
* @param studentLastName
*/
public Student(String studentID, String studentEmail, String studentFirstName,
String studentLastName) {
this.studentID = studentID;
this.studentEmail = studentEmail;
this.studentFirstName = studentFirstName;
this.studentLastName = studentLastName;
}
/**
* @return the studentID
*/
public String getStudentID() {
return studentID;
}
/**
* @param studentID
* the studentID to set
*/
public void setStudentID(String studentID) {
this.studentID = studentID;
}
/**
* @return the studentEmail
*/
public String getStudentEmail() {
return studentEmail;
}
/**
* @param studentEmail
* the studentEmail to set
*/
public void setStudentEmail(String studentEmail) {
this.studentEmail = studentEmail;
}
/**
* @return the studentFirstName
*/
public String getStudentFirstName() {
return studentFirstName;
}
/**
* @param studentFirstName
* the studentFirstName to set
*/
public void setStudentFirstName(String studentFirstName) {
this.studentFirstName = studentFirstName;
}
/**
* @return the studentLastName
*/
public String getStudentLastName() {
return studentLastName;
}
/**
* @param studentLastName
* the studentLastName to set
*/
public void setStudentLastName(String studentLastName) {
this.studentLastName = studentLastName;
}
}
------------------------------------------------------------------------------------------------------
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
public class JTableExample extends JFrame {
public JTableExample() {
// headers for the table
String[] columns = new String[] { \"Email\", \"First Name\", \"Last Name\" };
Student[] students = {
new Student(\"S123\", \"sri3(AT).com\", \"Srinu\", \"Vasu\"),
new Student(\"S124\", \"sri4(AT).com\", \"Rajesh\", \"Kumar\"),
new Student(\"S125\", \"sri5(AT).com\", \"Kumar\", \"Suresh\"),
new Student(\"S126\", \"sri6(AT).com\", \"Balaji\", \"kumar\") };
// actual data for the table in a 2d array
Object[][] data = new Object[students.length][3];
for (int i = 0; i < data.length; i++) {
data[i][0] = students[i].getStudentEmail();
data[i][1] = students[i].getStudentFirstName();
data[i][2] = students[i].getStudentLastName();
}
// create table with data
JTable table = new JTable(data, columns);
// add the table to the frame
this.add(new JScrollPane(table));
this.setTitle(\"Student Manager\");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.pack();
this.setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new JTableExample();
}
});
}
}
Solution
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
public class StudentAED
{
public student(String Email, String FN, String LN)
{
// Call super class constructor - Passing parameters required by student
super(Email, FN, LN);
final studentFileHandler pfh = new StudentFileHandler();
btnEdit.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
try
{
editPanel = new JPanel();
editPanel.setLayout(new GridLayout(9, 2));
editPanel.setPreferredSize(new Dimension(280, 280));
//Add radiobutton for priority
JRadioButton yes1 = new JRadioButton();
yes1.setText(\"Yes\");
JRadioButton no1 = new JRadioButton();
no1.setText(\"No\");
ButtonGroup group1 = new ButtonGroup();
group1.add(yes1);
group1.add(no1);
//Make an panel for the RadioButtons to be horizontal
radioButtonPanel1 = new JPanel();
radioButtonPanel1.setLayout(new GridLayout(1, 2));
radioButtonPanel1.setPreferredSize(new Dimension(40, 40));
radioButtonPanel1.add(yes1);
radioButtonPanel1.add(no1);
//Add the Email textfield
editPanel.add(new JLabel(\"Email : \"));
editPanel.add(editFirstNameText = new JTextField(20));
//Add the FirstName textfield
editPanel.add(new JLabel(\"Firstname : \"));
editPanel.add(editSurNameText = new JTextField(20));
//Add the LastName textfield
editPanel.add(new JLabel(\"Lastname : \"));
editPanel.add(editSurNameText = new JTextField(20));
// Put a Border around the Panel
editPanel.setBorder(new TitledBorder(\"Edit Email Details\"));
//Make custom buttons
Object[] customButtonSet1 = {\"Edit Email\", \"Cancel\"};
int customButtonClick1 = JOptionPane.showOptionDialog(null,editPanel,\"Edit\", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, customButtonSet1, customButtonSet1[1]);
if(customButtonClick1 == JOptionPane.YES_OPTION)
{
try
{
if(student(Integer.valueOf(input1)))
{
student myObj = student.get(Integer.valueOf(input1));
//JOptionPane.showMessageDialog(null, \"Succesfully edited the Email\");
String Email = String.valueOf(editTitleComboBox.getSelectedItem());
String FirstName1 = String.valueOf(editFirstNameText.getText());
String ListName1 = String.valueOf(editLastNameText.getText());
boolean priority1;
myObj.setName(new Name(Email, FirstName1, LastName1));
//Makes the toString clean
String formatedString = (student.toString().replace(\"[\", \"\").replace(\"]\", \"\").trim());
//refreshes the textArea and auto fills it with the current ArrayList
textArea.setText(\"\");
textArea.append(formatedString);
}
else
{
JOptionPane.showMessageDialog(null, “student does not exist\");
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
else
{
JOptionPane.showMessageDialog(null, \"Email does not exist\");
}
if(customButtonClick1 == JOptionPane.CANCEL_OPTION || customButtonClick1 == JOptionPane.NO_OPTION)
{
JOptionPane.showMessageDialog(null, \"No student\");
}
}
}
catch (Exception ex)
{
// do nothing
}
}
});





