Tuesday, December 3, 2013

dialog selecting problem?


I am trying to type in something that would bring up an options dialog box


problems :

when trying to open type in the option box to appear it doesnt

and also when trying to send the data to the external method isnt working either


public void edit() {

String employee = "please enter the last name of the employee you want to edit";

String edit = "Please enter what you would like to edit";


String employees = JOptionPane.showInputDialog(employee);

String edits = JOptionPane.showInputDialog(edit);


for (int i = 0; i < staffs.size(); i++) {

if (employees.equals(staffs.get(i).getSurname()))

if (edits.equals("first name")) {

String firstName = "Please enter the new first name";

String newFirstName = JOptionPane

.showInputDialog(firstName);

staffs.get(i).setFirstName(newFirstName);

}


else if (edits.equals("surname")) {

String surname = "Please enter the new surname";

String newSurname = JOptionPane.showInputDialog(surname);

staffs.get(i).setSurname(newSurname);


} else if (edits.equals("date of birth")) {

String dob = "Please enter the new date of birth";

String newDOB = JOptionPane.showInputDialog(dob);

staffs.get(i).setDOB(newDOB);


} else if (edits.equals("annual salary")) {

String annual = "Please enter the annual salary";

String newAnnual = JOptionPane.showInputDialog(annual);


int a = Integer.parseInt(newAnnual);

staffs.get(i).setAnnualSalary(a);


} else if (edit.equals("role")) {

Object[] choices = { "manager", "lecuter", "techician" };

Component frame = null;

Icon icon = null;

String s = (String) JOptionPane.showInputDialog(frame,

"Please enter select new role",


"Edit The Role", JOptionPane.PLAIN_MESSAGE, icon,

choices, "manager");

String newRole = s;


staffs.get(i).setSelectedRole(newRole);

}


}

}


}

}



No comments:

Post a Comment