Class AppListener

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.util.EventListener

    public class AppListener
    extends java.lang.Object
    implements java.awt.event.ActionListener
    This class handles the events on the window
    Author:
    RedNeath
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Main main
      This attribute contain the main program.
    • Constructor Summary

      Constructors 
      Constructor Description
      AppListener​(Main main)
      This contructor takes a main to work.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent e)
      This method tells what the program should do if the listener is triggered by the user.
      private void computeMagicPower()
      This method retrieves the infos given by the user in the gui and uses them to compute the magic power of the character.
      private double magicFunction​(double x)
      This method computes the magic power at a given age to send it bakc to computeMagicPower.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • main

        private Main main
        This attribute contain the main program. It is used to see what the source of the trigger is.
    • Constructor Detail

      • AppListener

        public AppListener​(Main main)
        This contructor takes a main to work.
        Parameters:
        main - The main that launched the code.
    • Method Detail

      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        This method tells what the program should do if the listener is triggered by the user.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Parameters:
        e - The event that triggered the listener.
      • computeMagicPower

        private void computeMagicPower()
        This method retrieves the infos given by the user in the gui and uses them to compute the magic power of the character.
      • magicFunction

        private double magicFunction​(double x)
                              throws java.lang.IllegalArgumentException
        This method computes the magic power at a given age to send it bakc to computeMagicPower.
        Parameters:
        x - The abs index of the function
        Returns:
        The y ord of the function at the index x.
        Throws:
        java.lang.IllegalArgumentException - if x is below 0.