private void cancelButtonActionPerformed(ActionEvent e) {
   cont.remove(this);
   cont.setCurrent(previous);
   cont.add(cont.getCurrent());
   cont.revalidate();
   cont.repaint();
 }
Пример #2
0
 @Override
 public void doCommand(String[] arguments, Container storage, Directory directory)
     throws InvalidWorkingException {
   if (storage == null) {
     throw new InvalidWorkingException(getName() + ": Command do not get storage to work with");
   }
   try {
     String value = storage.remove(arguments[0]);
     if (value == null) {
       System.out.println("not found");
     } else {
       System.out.println("removed");
     }
   } catch (InvalidWorkingException e) {
     System.out.println(e.getMessage());
   }
 }
 private void saveButtonActionPerformed(ActionEvent e) {
   String animal = animalField.getText();
   String color = colorField.getText();
   String name = nameField.getText();
   try {
     facade.addNewTrial(animal, color, name);
   } catch (Exception ex) {
     showError();
     ex.printStackTrace();
     return;
   }
   cont.remove(this);
   cont.setCurrent(previous);
   cont.add(cont.getCurrent());
   cont.revalidate();
   cont.repaint();
 }