|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjaron.gui.Rect
jaron.gui.ActuatorXY
public class ActuatorXY
The ActuatorXY
class is a generic GUI control that provides the
functionality to implement a component with an x- and a y-axis (e.g. a joystick).
By default positive x is to the right and positive y is up. Reversing is done
by swapping the high and the low signal values.
Field Summary | |
---|---|
Rect |
control
|
Constructor Summary | |
---|---|
ActuatorXY(int left,
int top,
int width,
int height)
Creates a new ActuatorXY object. |
|
ActuatorXY(int left,
int top,
int width,
int height,
int controlWidth,
int controlHeight)
Creates a new ActuatorXY object. |
Method Summary | |
---|---|
void |
addListenerX(SignalListener listener)
Adds a listener to the x-axis. |
void |
addListenerY(SignalListener listener)
Adds a listener to the y-axis. |
Signal |
getPowerSignal()
Returns a reference to a Signal object containing a value that
represents the current status of the actuator. |
Signal |
getSignalX()
Returns a Signal object containing a value that represents the
current value of the x-axis. |
Signal |
getSignalY()
Returns a Signal object containing a value that represents the
current value of the Y-axis. |
double |
getValueX()
Returns the current value of the x-axis. |
double |
getValueY()
Returns the current value of the y-axis. |
java.lang.Boolean |
isMouseOver()
Returns true if the mouse is hovering over the actuator. |
java.lang.Boolean |
isMousePressed()
Returns true if the user has clicked into the actuator. |
void |
mouseDragged(int x,
int y)
Handles a mouseDragged event that occurred in the GUI. |
void |
mouseMoved(int x,
int y)
Handles a mouseMoved event that occurred in the GUI. |
void |
mousePressed(int x,
int y)
Handles a mousePressed event that occurred in the GUI. |
void |
mouseReleased(int x,
int y)
Handles a mouseReleased event that occurred in the GUI. |
void |
setBandwidthX(double low,
double high)
Sets the low and the high values of the signal for the x-axis. |
void |
setBandwidthY(double low,
double high)
Sets the low and the high values of the signal for the y-axis. |
void |
setControlSize(int width,
int height)
Sets the size of the control. |
void |
setLocation(int left,
int top)
Moves the Rect to the specified location. |
void |
setLockedX(java.lang.Boolean state)
Sets the actuator's x-axis locked ( true ) or unlocked (false ). |
void |
setLockedY(java.lang.Boolean state)
Sets the actuator's y-axis locked ( true ) or unlocked (false ). |
void |
setSize(int width,
int height)
Sets the width and height of the Rect. |
void |
setSpringX(java.lang.Boolean state)
Sets the actuator's x-axis to act like it had a spring that moves the control back to its neutral/middle position after release. |
void |
setSpringY(java.lang.Boolean state)
Sets the actuator's y-axis to act like it had a spring that moves the control back to its neutral/middle position after release. |
void |
setValue(double value)
Sets the signal's value. |
void |
setValueX(double value)
Sets the value of the actuator's x-axis. |
void |
setValueY(double value)
Sets the value of the actuator's y-axis. |
void |
signalChanged(SignalEvent event)
Notifies the listener about a signal change event that occurred in the EventListener mechanism. |
Methods inherited from class jaron.gui.Rect |
---|
contains, createIntersection, getHeight, getLeft, getTop, getWidth, setHeight, setLeft, setTop, setWidth |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public Rect control
Constructor Detail |
---|
public ActuatorXY(int left, int top, int width, int height, int controlWidth, int controlHeight)
ActuatorXY
object. It provides the basic functionality
to implement a two axis GUI element (e.g. a joystick or slider or the like).
left
- left positiontop
- top positionwidth
- the width of the actuatorheight
- the height of the actuatorcontrolWidth
- the width of the control (e.g. a stick or a lever)controlHeight
- the width of the control (e.g. a stick or a lever)public ActuatorXY(int left, int top, int width, int height)
ActuatorXY
object. It provides the basic functionality
to implement a two axis GUI element (e.g. a joystick or slider or the like).
left
- left positiontop
- top positionwidth
- the width of the actuatorheight
- the height of the actuatorMethod Detail |
---|
public void addListenerX(SignalListener listener)
EventListener
mechanism.
listener
- the listener to be added to the x-axisSignalListener
public void addListenerY(SignalListener listener)
EventListener
mechanism.
listener
- the listener to be added to the y-axisSignalListener
public Signal getPowerSignal()
Signal
object containing a value that
represents the current status of the actuator. The status is either on
(getSignal
equals getHigh
) or off
(getSignal
equals getLow
).
Signal
object containing the current statusSignal
public Signal getSignalX()
Signal
object containing a value that represents the
current value of the x-axis.setHigh
and setLow
methods of the Signal class.
Signal
object containing the current x-axis valueSignal
public Signal getSignalY()
Signal
object containing a value that represents the
current value of the Y-axis.setHigh
and setLow
methods of the Signal class.
Signal
object containing the current y-axis valueSignal
public double getValueX()
Signal
public double getValueY()
Signal
public java.lang.Boolean isMouseOver()
public java.lang.Boolean isMousePressed()
public void mouseDragged(int x, int y)
mouseDragged
event that occurred in the GUI.mouseDragged
method of the GUI (e.g. in the Processing Development Environment). This
ensures that the user interaction is received and processed by the actuator.
x
- the current x value of the mousey
- the current y value of the mousepublic void mousePressed(int x, int y)
mousePressed
event that occurred in the GUI.mousePressed
method of the GUI (e.g. in the Processing Development Environment). This
ensures that the user interaction is received and processed by the actuator.
x
- the current x value of the mousey
- the current y value of the mousepublic void mouseReleased(int x, int y)
mouseReleased
event that occurred in the GUI.mouseReleased
method of the GUI (e.g. in the Processing Development Environment). This
ensures that the user interaction is received and processed by the actuator.
x
- the current x value of the mousey
- the current y value of the mousepublic void mouseMoved(int x, int y)
mouseMoved
event that occurred in the GUI.mouseMoved
method of the GUI (e.g. in the Processing Development Environment). This
ensures that the user interaction is received and processed by the actuator.
x
- the current x value of the mousey
- the current y value of the mousepublic void setBandwidthX(double low, double high)
low
- the low end of the bandwidthhigh
- the high end of the bandwidthpublic void setBandwidthY(double low, double high)
low
- the low end of the bandwidthhigh
- the high end of the bandwidthpublic void setControlSize(int width, int height)
width
- the control's new widthheight
- the control's new heightpublic void setLocation(int left, int top)
Rect
setLocation
in class Rect
left
- the x coordinate of the new locationtop
- the y coordinate of the new locationpublic void setLockedX(java.lang.Boolean state)
true
) or unlocked (false
).
The purpose of this functionality is a one axis actuator whose other, unused axis
is locked and therefore can't be moved by the user.
state
- either true
or false
public void setLockedY(java.lang.Boolean state)
true
) or unlocked (false
).
The purpose of this functionality is a one axis actuator whose other, unused axis
is locked and therefore can't be moved by the user.
state
- either true
or false
public void setSpringX(java.lang.Boolean state)
state
- either true
or false
public void setSpringY(java.lang.Boolean state)
state
- either true
or false
public void setSize(int width, int height)
Rect
setSize
in class Rect
width
- the new widthheight
- the new heightpublic void setValueX(double value)
value
- the new value of the x-axisSignal
public void setValueY(double value)
value
- the new value of the y-axisSignal
public void setValue(double value)
SignalListener
EventListener
mechanism to set the signal's value.
setValue
in interface SignalListener
value
- the notifier's signal value that has changed or just the new signal valuepublic void signalChanged(SignalEvent event)
SignalListener
EventListener
mechanism.
signalChanged
in interface SignalListener
event
- the event that occurred
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |