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 double
private FPanel
private BufferedImage
private static int
private static int
private static int
private static int
private FPanel
private boolean
private double
private double
private double
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate double
Return the distance between the mouse location & the Creature location.private double
private double
getX()
private double
private double
getY()
private double
private void
iniPanel()
It initialize the panel.private void
iniXY()
Initialize x & y.private boolean
Test if Creature is close enoth of mouse.private void
Move closer to the mouse at max speed.private void
moveAngleTo
(double newAngle) Move angle to the new angle value, but slowly.void
run()
Update the position of animate item on the menu screen.private void
setRunning
(boolean b) private void
Update 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.
-