Package jexer.event
Class TMouseEvent
- java.lang.Object
-
- jexer.event.TInputEvent
-
- jexer.event.TMouseEvent
-
public class TMouseEvent extends TInputEvent
This class encapsulates several kinds of mouse input events. Note that the relative (x,y) ARE MUTABLE: TWidget's onMouse() handlers perform that update during event dispatching.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TMouseEvent.Type
The type of event generated.
-
Constructor Summary
Constructors Constructor Description TMouseEvent(Backend backend, TMouseEvent.Type type, int x, int y, int absoluteX, int absoluteY, boolean mouse1, boolean mouse2, boolean mouse3, boolean mouseWheelUp, boolean mouseWheelDown, boolean alt, boolean ctrl, boolean shift)
Public contructor.TMouseEvent(Backend backend, TMouseEvent.Type type, int x, int y, int absoluteX, int absoluteY, int pixelOffsetX, int pixelOffsetY, boolean mouse1, boolean mouse2, boolean mouse3, boolean mouseWheelUp, boolean mouseWheelDown, boolean alt, boolean ctrl, boolean shift)
Public contructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TMouseEvent
dup()
Create a duplicate instance.int
getAbsoluteX()
Get absoluteX.int
getAbsoluteY()
Get absoluteY.int
getPixelOffsetX()
Get pixelOffsetX.int
getPixelOffsetY()
Get pixelOffsetY.TMouseEvent.Type
getType()
Get type.int
getX()
Get x.int
getY()
Get y.boolean
isAlt()
Getter for ALT.boolean
isCtrl()
Getter for CTRL.boolean
isMouse1()
Get mouse1.boolean
isMouse2()
Get mouse2.boolean
isMouse3()
Get mouse3.boolean
isMouseWheelDown()
Get mouseWheelDown.boolean
isMouseWheelUp()
Get mouseWheelUp.boolean
isShift()
Getter for SHIFT.void
setAbsoluteX(int absoluteX)
Set absoluteX.void
setAbsoluteY(int absoluteY)
Set absoluteY.void
setPixelOffsetX(int pixelOffsetX)
Set pixelOffsetX.void
setPixelOffsetY(int pixelOffsetY)
Set pixelOffsetY.void
setX(int x)
Set x.void
setY(int y)
Set y.java.lang.String
toString()
Make human-readable description of this TMouseEvent.-
Methods inherited from class jexer.event.TInputEvent
getBackend, getTime
-
-
-
-
Constructor Detail
-
TMouseEvent
public TMouseEvent(Backend backend, TMouseEvent.Type type, int x, int y, int absoluteX, int absoluteY, boolean mouse1, boolean mouse2, boolean mouse3, boolean mouseWheelUp, boolean mouseWheelDown, boolean alt, boolean ctrl, boolean shift)
Public contructor.- Parameters:
backend
- the backend that generated this eventtype
- the type of event, MOUSE_MOTION, MOUSE_DOWN, or MOUSE_UPx
- relative columny
- relative rowabsoluteX
- absolute columnabsoluteY
- absolute rowmouse1
- if true, left button is downmouse2
- if true, right button is downmouse3
- if true, middle button is downmouseWheelUp
- if true, mouse wheel (button 4) is downmouseWheelDown
- if true, mouse wheel (button 5) is downalt
- if true, ALT was pressed with this mouse eventctrl
- if true, CTRL was pressed with this mouse eventshift
- if true, SHIFT was pressed with this mouse event
-
TMouseEvent
public TMouseEvent(Backend backend, TMouseEvent.Type type, int x, int y, int absoluteX, int absoluteY, int pixelOffsetX, int pixelOffsetY, boolean mouse1, boolean mouse2, boolean mouse3, boolean mouseWheelUp, boolean mouseWheelDown, boolean alt, boolean ctrl, boolean shift)
Public contructor.- Parameters:
backend
- the backend that generated this eventtype
- the type of event, MOUSE_MOTION, MOUSE_DOWN, or MOUSE_UPx
- relative columny
- relative rowabsoluteX
- absolute columnabsoluteY
- absolute rowpixelOffsetX
- X pixel offset relative to text cellpixelOffsetY
- Y pixel offset relative to text cellmouse1
- if true, left button is downmouse2
- if true, right button is downmouse3
- if true, middle button is downmouseWheelUp
- if true, mouse wheel (button 4) is downmouseWheelDown
- if true, mouse wheel (button 5) is downalt
- if true, ALT was pressed with this mouse eventctrl
- if true, CTRL was pressed with this mouse eventshift
- if true, SHIFT was pressed with this mouse event
-
-
Method Detail
-
getType
public TMouseEvent.Type getType()
Get type.- Returns:
- type
-
getX
public int getX()
Get x.- Returns:
- x
-
setX
public void setX(int x)
Set x.- Parameters:
x
- new relative X value- See Also:
TWidget.onMouseDown(TMouseEvent mouse)
,TWidget.onMouseDown(TMouseEvent mouse)
,TWidget.onMouseMotion(TMouseEvent mouse)
-
getY
public int getY()
Get y.- Returns:
- y
-
setY
public void setY(int y)
Set y.- Parameters:
y
- new relative Y value- See Also:
TWidget.onMouseDown(TMouseEvent mouse)
,TWidget.onMouseDown(TMouseEvent mouse)
,TWidget.onMouseMotion(TMouseEvent mouse)
-
getAbsoluteX
public int getAbsoluteX()
Get absoluteX.- Returns:
- absoluteX
-
setAbsoluteX
public void setAbsoluteX(int absoluteX)
Set absoluteX.- Parameters:
absoluteX
- the new value
-
getAbsoluteY
public int getAbsoluteY()
Get absoluteY.- Returns:
- absoluteY
-
setAbsoluteY
public void setAbsoluteY(int absoluteY)
Set absoluteY.- Parameters:
absoluteY
- the new value
-
getPixelOffsetX
public int getPixelOffsetX()
Get pixelOffsetX.- Returns:
- pixelOffsetX
-
setPixelOffsetX
public void setPixelOffsetX(int pixelOffsetX)
Set pixelOffsetX.- Parameters:
pixelOffsetX
- the new value
-
getPixelOffsetY
public int getPixelOffsetY()
Get pixelOffsetY.- Returns:
- pixelOffsetY
-
setPixelOffsetY
public void setPixelOffsetY(int pixelOffsetY)
Set pixelOffsetY.- Parameters:
pixelOffsetY
- the new value
-
isMouse1
public boolean isMouse1()
Get mouse1.- Returns:
- mouse1
-
isMouse2
public boolean isMouse2()
Get mouse2.- Returns:
- mouse2
-
isMouse3
public boolean isMouse3()
Get mouse3.- Returns:
- mouse3
-
isMouseWheelUp
public boolean isMouseWheelUp()
Get mouseWheelUp.- Returns:
- mouseWheelUp
-
isMouseWheelDown
public boolean isMouseWheelDown()
Get mouseWheelDown.- Returns:
- mouseWheelDown
-
isAlt
public boolean isAlt()
Getter for ALT.- Returns:
- alt value
-
isCtrl
public boolean isCtrl()
Getter for CTRL.- Returns:
- ctrl value
-
isShift
public boolean isShift()
Getter for SHIFT.- Returns:
- shift value
-
dup
public TMouseEvent dup()
Create a duplicate instance.- Returns:
- duplicate intance
-
toString
public java.lang.String toString()
Make human-readable description of this TMouseEvent.- Overrides:
toString
in classjava.lang.Object
- Returns:
- displayable String
-
-