Class RadianceRootPaneUI.MouseInputHandler
java.lang.Object
org.pushingpixels.radiance.theming.internal.ui.RadianceRootPaneUI.MouseInputHandler
- All Implemented Interfaces:
MouseListener
,MouseMotionListener
,EventListener
,MouseInputListener
- Enclosing class:
RadianceRootPaneUI
MouseInputHandler is responsible for handling resize/moving of the Window. It sets the cursor
directly on the Window when then mouse moves over a hot spot.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate RadianceRootPaneUI.CursorState
private int
Used to determine the corner the resize is occurring from.private int
Height of the window when the drag started.private int
X location the mouse went down on for a drag operation.private int
Y location the mouse went down on for a drag operation.private int
Width of the window when the drag started.private boolean
private boolean
Set to true if the drag operation is moving the window. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Adjusts the bounds.private int
calculateCorner
(Window w, int x, int y) Returns the corner that contains the pointx
,y
, or -1 if the position doesn't match a corner.private int
calculatePosition
(int spot, int width) Returns an integer indicating the position ofspot
inwidth
.private int
getCursor
(int corner) Returns the Cursor to render for the specified corner.void
void
void
void
void
mouseMoved
(MouseEvent ev) void
void
-
Field Details
-
isMovingWindow
private boolean isMovingWindowSet to true if the drag operation is moving the window. -
isMousePressed
private boolean isMousePressed -
dragCursor
private int dragCursorUsed to determine the corner the resize is occurring from. -
dragOffsetX
private int dragOffsetXX location the mouse went down on for a drag operation. -
dragOffsetY
private int dragOffsetYY location the mouse went down on for a drag operation. -
dragWidth
private int dragWidthWidth of the window when the drag started. -
dragHeight
private int dragHeightHeight of the window when the drag started. -
cursorState
-
-
Constructor Details
-
MouseInputHandler
private MouseInputHandler()
-
-
Method Details
-
mousePressed
- Specified by:
mousePressed
in interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleased
in interfaceMouseListener
-
mouseMoved
- Specified by:
mouseMoved
in interfaceMouseMotionListener
-
adjust
private void adjust(Rectangle bounds, Dimension min, int deltaX, int deltaY, int deltaWidth, int deltaHeight) Adjusts the bounds.- Parameters:
bounds
- Original bounds.min
- Minimum dimension.deltaX
- Delta X.deltaY
- Delta Y.deltaWidth
- Delta width.deltaHeight
- Delta height.
-
mouseDragged
- Specified by:
mouseDragged
in interfaceMouseMotionListener
-
mouseEntered
- Specified by:
mouseEntered
in interfaceMouseListener
-
mouseExited
- Specified by:
mouseExited
in interfaceMouseListener
-
mouseClicked
- Specified by:
mouseClicked
in interfaceMouseListener
-
calculateCorner
Returns the corner that contains the pointx
,y
, or -1 if the position doesn't match a corner.- Parameters:
w
- Window.x
- X coordinate.y
- Y coordinate.- Returns:
- Corner that contains the specified point.
-
getCursor
private int getCursor(int corner) Returns the Cursor to render for the specified corner. This returns 0 if the corner doesn't map to a valid Cursor- Parameters:
corner
- Corner- Returns:
- Cursor to render for the specified corner.
-
calculatePosition
private int calculatePosition(int spot, int width) Returns an integer indicating the position ofspot
inwidth
. The return value will be: 0 if invalid input: '<' BORDER_DRAG_THICKNESS 1 if invalid input: '<' CORNER_DRAG_WIDTH 2 if >= CORNER_DRAG_WIDTH invalid input: '&'invalid input: '&' invalid input: '<' width - BORDER_DRAG_THICKNESS 3 if >= width - CORNER_DRAG_WIDTH 4 if >= width - BORDER_DRAG_THICKNESS 5 otherwise- Parameters:
spot
- Spot.width
- Width.- Returns:
- The position of spot in width.
-