Class AppListener
- java.lang.Object
-
- AppListener
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.util.EventListener
public class AppListener extends java.lang.Object implements java.awt.event.ActionListenerThis class handles the events on the window- Author:
- RedNeath
-
-
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 voidactionPerformed(java.awt.event.ActionEvent e)This method tells what the program should do if the listener is triggered by the user.private voidcomputeMagicPower()This method retrieves the infos given by the user in the gui and uses them to compute the magic power of the character.private doublemagicFunction(double x)This method computes the magic power at a given age to send it bakc to computeMagicPower.
-
-
-
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:
actionPerformedin interfacejava.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.IllegalArgumentExceptionThis 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.
-
-