Package fr.formiko.views.gui2d
Class FPanelMenu.ThreadMenu
java.lang.Object
java.lang.Thread
fr.formiko.views.gui2d.FPanelMenu.ThreadMenu
- All Implemented Interfaces:
Runnable
- Enclosing class:
FPanelMenu
Update the position of animate item on the menu screen.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleprivate FPanelprivate BufferedImageprivate static intprivate static intprivate static intprivate static intprivate FPanelprivate booleanprivate doubleprivate doubleprivate doubleFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate doubleReturn the distance between the mouse location & the Creature location.private doubleprivate doublegetX()private doubleprivate doublegetY()private doubleprivate voidiniPanel()It initialize the panel.private voidiniXY()Initialize x & y.private booleanTest if Creature is close enoth of mouse.private voidMove closer to the mouse at max speed.private voidmoveAngleTo(double newAngle) Move angle to the new angle value, but slowly.voidrun()Update the position of animate item on the menu screen.private voidsetRunning(boolean b) private voidUpdate the position of animate item for 1 step.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
running
private boolean running -
flyingCreature
-
x
private double x -
y
private double y -
angle
private double angle -
watchingCircle
private double watchingCircle -
p
-
container
-
MAX_STARTING_Y
private static int MAX_STARTING_Y -
MAX_Y
private static int MAX_Y -
MIN_Y
private static int MIN_Y -
MAX_MOVING_SPEED
private static int MAX_MOVING_SPEED
-
-
Constructor Details
-
ThreadMenu
Main constructor.- Parameters:
container- the container of the Panel were the image is draw
-
-
Method Details
-
setRunning
private void setRunning(boolean b) -
getX
private double getX() -
getY
private double getY() -
getXCentered
private double getXCentered() -
getYCentered
private double getYCentered() -
getWatchingCircle
private double getWatchingCircle() -
run
public void run()Update the position of animate item on the menu screen.
It initialize the panel & then move the images -
iniXY
private void iniXY()Initialize x & y.
x is before the left of the screen. y is random in [0;MAX_STARTING_Y]. -
moveAngleTo
private void moveAngleTo(double newAngle) Move angle to the new angle value, but slowly. -
mooveToMouse
private void mooveToMouse()Move closer to the mouse at max speed. -
getDistance
private double getDistance()Return the distance between the mouse location & the Creature location. -
isCloseToMouse
private boolean isCloseToMouse()Test if Creature is close enoth of mouse. -
updateLocation
private void updateLocation()Update the position of animate item for 1 step. -
iniPanel
private void iniPanel()It initialize the panel.
-