public class Joystick extends WidgetWithListener implements ej.fp.MouseListener, ThirdEventThread.ThirdEventWidget
Notes:
Button.ButtonListener
to send the button events,setDisableEnter(boolean)
method.Modifier and Type | Class and Description |
---|---|
static interface |
Joystick.JoystickListener
Interface that handle joystick buttons events.
|
static class |
Joystick.JoystickListenerToCommandEvents
Default implementation of
Joystick.JoystickListener . |
Constructor and Description |
---|
Joystick()
Creates a joystick widget.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
void |
finalizeConfiguration() |
int |
getSleepPeriod()
The thread sleep period is different than buttons period: thread should work faster than the buttons period in
order to be able to simulate several repeat event on several buttons.
|
void |
mousePressed(int x,
int y,
ej.fp.MouseListener.MouseButton button) |
void |
mouseReleased(int x,
int y,
ej.fp.MouseListener.MouseButton button) |
protected java.lang.Object |
newDefaultListener()
Lets subclass creates a default listener.
|
void |
sendThirdEvent()
Asks to send the third event.
|
void |
setDisableEnter(boolean disableEnter)
Disables enter button.
|
void |
setDownSkin(ej.fp.Image skin)
Sets the skin to show joystick DOWN action.
|
void |
setEnterSkin(ej.fp.Image skin)
Sets the skin to show joystick ENTER action.
|
void |
setLeftSkin(ej.fp.Image skin)
Sets the skin to show joystick LEFT action.
|
void |
setListenerClass(java.lang.String listenerClassName)
Defines the user class which has to implement
Joystick.JoystickListener . |
void |
setRepeatPeriod(int period)
Sets the repeat event period.
|
void |
setRightSkin(ej.fp.Image skin)
Sets the skin to show joystick RIGHT action.
|
void |
setUpSkin(ej.fp.Image skin)
Sets the skin to show joystick UP action.
|
void |
start() |
newListener, setListenerClass
getAbsoluteX, getAbsoluteY, getCurrentSkin, getFilter, getHeight, getLabel, getParent, getSkin, getWidth, getX, getY, isOver, repaint, repaint, setCurrentSkin, setFilter, setHeight, setLabel, setOverlay, setSkin, setWidth, setX, setY, showYourself
public Joystick()
The default repeat period is 200ms.
public void setUpSkin(ej.fp.Image skin)
This method should only be called by front panel parser.
skin
- skin for joystick UP action.public void setDownSkin(ej.fp.Image skin)
This method should only be called by front panel parser.
skin
- skin for joystick DOWN action.public void setLeftSkin(ej.fp.Image skin)
This method should only be called by front panel parser.
skin
- skin for joystick LEFT action.public void setRightSkin(ej.fp.Image skin)
This method should only be called by front panel parser.
skin
- skin for joystick RIGHT action.public void setEnterSkin(ej.fp.Image skin)
This method should only be called by front panel parser.
skin
- skin for joystick ENTER action.public void setRepeatPeriod(int period)
This method should only be called by front panel parser.
period
- a time in milliseconds.public void setDisableEnter(boolean disableEnter)
This method should only be called by front panel parser.
disableEnter
- true to disable enter button.public void setListenerClass(java.lang.String listenerClassName)
Joystick.JoystickListener
.
This method should only be called by front panel parser.
listenerClassName
- user listener class name.public void finalizeConfiguration()
finalizeConfiguration
in class ej.fp.Widget
public void start()
start
in class ej.fp.Widget
public void dispose()
dispose
in class ej.fp.Widget
protected java.lang.Object newDefaultListener()
WidgetWithListener
newDefaultListener
in class WidgetWithListener
public void sendThirdEvent()
ThirdEventThread.ThirdEventWidget
sendThirdEvent
in interface ThirdEventThread.ThirdEventWidget
public int getSleepPeriod()
getSleepPeriod
in interface ThirdEventThread.ThirdEventWidget
public void mousePressed(int x, int y, ej.fp.MouseListener.MouseButton button)
mousePressed
in interface ej.fp.MouseListener
public void mouseReleased(int x, int y, ej.fp.MouseListener.MouseButton button)
mouseReleased
in interface ej.fp.MouseListener