Class RadianceRootPaneUI.MouseInputHandler
- java.lang.Object
-
- org.pushingpixels.radiance.theming.internal.ui.RadianceRootPaneUI.MouseInputHandler
-
- All Implemented Interfaces:
java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.util.EventListener
,javax.swing.event.MouseInputListener
- Enclosing class:
- RadianceRootPaneUI
private class RadianceRootPaneUI.MouseInputHandler extends java.lang.Object implements javax.swing.event.MouseInputListener
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
Fields Modifier and Type Field Description private RadianceRootPaneUI.CursorState
cursorState
private int
dragCursor
Used to determine the corner the resize is occurring from.private int
dragHeight
Height of the window when the drag started.private int
dragOffsetX
X location the mouse went down on for a drag operation.private int
dragOffsetY
Y location the mouse went down on for a drag operation.private int
dragWidth
Width of the window when the drag started.private boolean
isMousePressed
private boolean
isMovingWindow
Set to true if the drag operation is moving the window.
-
Constructor Summary
Constructors Modifier Constructor Description private
MouseInputHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
adjust(java.awt.Rectangle bounds, java.awt.Dimension min, int deltaX, int deltaY, int deltaWidth, int deltaHeight)
Adjusts the bounds.private int
calculateCorner(java.awt.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
mouseClicked(java.awt.event.MouseEvent ev)
void
mouseDragged(java.awt.event.MouseEvent ev)
void
mouseEntered(java.awt.event.MouseEvent ev)
void
mouseExited(java.awt.event.MouseEvent ev)
void
mouseMoved(java.awt.event.MouseEvent ev)
void
mousePressed(java.awt.event.MouseEvent ev)
void
mouseReleased(java.awt.event.MouseEvent ev)
-
-
-
Field Detail
-
isMovingWindow
private boolean isMovingWindow
Set to true if the drag operation is moving the window.
-
isMousePressed
private boolean isMousePressed
-
dragCursor
private int dragCursor
Used to determine the corner the resize is occurring from.
-
dragOffsetX
private int dragOffsetX
X location the mouse went down on for a drag operation.
-
dragOffsetY
private int dragOffsetY
Y location the mouse went down on for a drag operation.
-
dragWidth
private int dragWidth
Width of the window when the drag started.
-
dragHeight
private int dragHeight
Height of the window when the drag started.
-
cursorState
private RadianceRootPaneUI.CursorState cursorState
-
-
Method Detail
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent ev)
- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent ev)
- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent ev)
- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
-
adjust
private void adjust(java.awt.Rectangle bounds, java.awt.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
public void mouseDragged(java.awt.event.MouseEvent ev)
- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent ev)
- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent ev)
- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent ev)
- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
-
calculateCorner
private int calculateCorner(java.awt.Window w, int x, int y)
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 < BORDER_DRAG_THICKNESS 1 if < CORNER_DRAG_WIDTH 2 if >= CORNER_DRAG_WIDTH && < 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.
-
-