Interface MouseInteractionController
- All Known Implementing Classes:
GuiComponent, TextEditComponent
public interface MouseInteractionController
Interface that allows to handle mouse events.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanmouseClicked(int button) Called when mouse is clicked on component.default booleanmouseClicked(int button, double textureU, double textureV) Called when mouse is clicked on component, with the exact texture coordinates of the clicked point when the hit shape is textured.default booleanmouseClicked(int button, double textureU, double textureV, KeyboardFocusStack focusStack) Called when mouse is clicked on component, additionally carrying the keyboard focus stack of the dispatching view.booleanCalled when mouse gets over given component.booleanCalled when mouse leaves screen area occupied by component.default booleanmouseHover(double textureU, double textureV) Called when the mouse hovers over this component, with the exact texture coordinates of the hovered point when the hit shape is textured (NaN otherwise).default booleanmouseWheelMoved(int verticalUnits, int horizontalUnits) Called when the mouse wheel is turned while this component has keyboard focus.
-
Method Details
-
mouseClicked
boolean mouseClicked(int button) Called when mouse is clicked on component.- Parameters:
button- the mouse button that was clicked (1 = left, 2 = middle, 3 = right)- Returns:
trueif view update is needed as a consequence of this mouse click
-
mouseClicked
default boolean mouseClicked(int button, double textureU, double textureV) Called when mouse is clicked on component, with the exact texture coordinates of the clicked point when the hit shape is textured.The default implementation ignores the texture coordinates and delegates to
mouseClicked(int). Components that need to know WHERE on their surface the click landed (e.g. to forward the click into a captured application window) override this method.- Parameters:
button- the mouse button that was clicked (1 = left, 2 = middle, 3 = right)textureU- texture-space X of the clicked point in primary-texture pixels, orDouble.NaNwhen the hit shape has no texturetextureV- texture-space Y of the clicked point in primary-texture pixels, orDouble.NaNwhen the hit shape has no texture- Returns:
trueif view update is needed as a consequence of this mouse click
-
mouseClicked
default boolean mouseClicked(int button, double textureU, double textureV, KeyboardFocusStack focusStack) Called when mouse is clicked on component, additionally carrying the keyboard focus stack of the dispatching view.Components that take keyboard focus on click should override THIS method rather than reaching for a stored ViewPanel reference: scenes built headlessly (golden-image harness) construct components with a null panel, but the dispatching view always has a focus stack.
The default implementation ignores the focus stack and delegates to
mouseClicked(int, double, double).- Parameters:
button- the mouse button that was clicked (1 = left, 2 = middle, 3 = right)textureU- texture-space X of the clicked point, orDouble.NaNtextureV- texture-space Y of the clicked point, orDouble.NaNfocusStack- keyboard focus stack of the dispatching view- Returns:
trueif view update is needed as a consequence of this mouse click
-
mouseWheelMoved
default boolean mouseWheelMoved(int verticalUnits, int horizontalUnits) Called when the mouse wheel is turned while this component has keyboard focus. Both axes are reported: horizontal wheel input arrives from AWT as shift-modified vertical rotation and is separated by the input manager.Returning
falselets the wheel fall through to the default camera movement.- Parameters:
verticalUnits- wheel notches; positive = wheel away from the user (content scrolls down)horizontalUnits- wheel notches; positive = scroll right- Returns:
trueif the component consumed the scroll
-
mouseHover
default boolean mouseHover(double textureU, double textureV) Called when the mouse hovers over this component, with the exact texture coordinates of the hovered point when the hit shape is textured (NaN otherwise). Allows components that forward input into a captured application window to track the pointer position.- Returns:
trueif view update is needed
-
mouseEntered
boolean mouseEntered()Called when mouse gets over given component.- Returns:
trueif view update is needed as a consequence of this mouse enter.
-
mouseExited
boolean mouseExited()Called when mouse leaves screen area occupied by component.- Returns:
trueif view update is needed as a consequence of this mouse exit.
-