Package de.axxeed.animosy.gui

Source Code of de.axxeed.animosy.gui.MenuActions

package de.axxeed.animosy.gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JOptionPane;

import org.apache.log4j.Logger;

import de.axxeed.animosy.gui.history.History;
import de.axxeed.animosy.model.Manager;


/**
* @author Markus J. Luzius
* Created 25.04.2006 11:24:34
*
*/
public class MenuActions implements ActionListener {

  private static Logger log = Logger.getLogger(MenuActions.class);

  /* (non-Javadoc)
   * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
   */
  public void actionPerformed(ActionEvent ae) {
    log.debug("Action: "+ae);
    log.debug("Action: <"+ae.getActionCommand()+">");

    if(ae.getActionCommand().equals(MainMenu.ACTION_QUIT)) {
      if(JOptionPane.showConfirmDialog(null,
          "Do you really want to quit?",
          "Quit AnImOSY",
          JOptionPane.YES_NO_OPTION,
          JOptionPane.QUESTION_MESSAGE) == 0
      ) {
        System.exit(0);
      }
    }
    else if(ae.getActionCommand().equals(MainMenu.ACTION_NEW)) {
      log.debug("Starting new game...");
      Manager.getGame().startGame();
    }
    else if(ae.getActionCommand().equals(MainMenu.ACTION_OPTIONS)) {
      OptionsDialog od = new OptionsDialog();
      od.setVisible(true);
    }
    else if(ae.getActionCommand().equals(MainMenu.ACTION_HISTORY)) {
      History hd = new History();
      hd.setVisible(true);
    }
    else if(ae.getActionCommand().equals(MainMenu.ACTION_TRACKER)) {
      // state is set automatically!
    }
    else if(ae.getActionCommand().equals(MainMenu.ACTION_ABOUT)) {
      AboutDialog ad = new AboutDialog();
      ad.setVisible(true);
    }
    else if(ae.getActionCommand().equals(MainMenu.ACTION_HELP)) {
      HTMLDialog hd = new HTMLDialog("html/help.html", "Help");
      hd.setVisible(true);
    }
    else if(ae.getActionCommand().equals(MainMenu.ACTION_LICENSE)) {
      HTMLDialog hd = new HTMLDialog("html/license.html", "License");
      hd.setVisible(true);
    }
    else if(ae.getActionCommand().equals(MainMenu.ACTION_REVISIONS)) {
      HTMLDialog hd = new HTMLDialog("html/history.html", "Revisions");
      hd.setVisible(true);
    }

  }

}
TOP

Related Classes of de.axxeed.animosy.gui.MenuActions

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.