Example #1
0
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == theView.getRemoveButton()) {
      removeSelected();
    }

    if (e.getSource() == theView.getSaveButton()) {
      for (Object obj : theView.getLoadedList().getSelectedValuesList()) {
        PlayerCharacter pc = model.get(obj);
        savePC(pc, false);
      }
    }

    if (e.getSource() == theView.getSaveAsButton()) {
      for (Object obj : theView.getLoadedList().getSelectedValuesList()) {
        PlayerCharacter pc = model.get(obj);
        savePC(pc, true);
      }
    }

    if (e.getSource() == theView.getLoadButton()) {
      handleOpen();
    }

    theView.getLoadedList().repaint();
  }
Example #2
0
 /** Registers all the listeners for any actions. */
 public void initListeners() {
   theView.getRemoveButton().addActionListener(this);
   theView.getSaveButton().addActionListener(this);
   theView.getSaveAsButton().addActionListener(this);
   theView.getLoadButton().addActionListener(this);
 }