/**
* Save clicked action handler
*/
private void saveButton_Clicked()
{
Person p = null;
try
{
p = new Person(firstNameTextField.getText(), lastNameTextField.getText(),
new MileStone(Integer.parseInt(fromYearTextField.getText()),
Integer.parseInt(toYearTextField.getText()),
new MileStonePlace(mileStonePlaceComboBox.getSelectedItem().toString()),
mileStoneComboBox.getSelectedItem().toString())
);
caller.setEnabled(true);
this.dispose();
}
catch (NumberFormatException e)
{
JOptionPane.showMessageDialog(this, "Bad year input");
}
catch (Exception e)
{
JOptionPane.showMessageDialog(this, e.getMessage());
}
finally
{
if (p != null)
{
System.out.println(p.toString());
caller.addPerson(p);
}
}
}