예제 #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();
  }
예제 #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);
 }