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.MouseInputListenerMouseInputHandler 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.CursorStatecursorStateprivate intdragCursorUsed to determine the corner the resize is occurring from.private intdragHeightHeight of the window when the drag started.private intdragOffsetXX location the mouse went down on for a drag operation.private intdragOffsetYY location the mouse went down on for a drag operation.private intdragWidthWidth of the window when the drag started.private booleanisMousePressedprivate booleanisMovingWindowSet to true if the drag operation is moving the window.
-
Constructor Summary
Constructors Modifier Constructor Description privateMouseInputHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidadjust(java.awt.Rectangle bounds, java.awt.Dimension min, int deltaX, int deltaY, int deltaWidth, int deltaHeight)Adjusts the bounds.private intcalculateCorner(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 intcalculatePosition(int spot, int width)Returns an integer indicating the position ofspotinwidth.private intgetCursor(int corner)Returns the Cursor to render for the specified corner.voidmouseClicked(java.awt.event.MouseEvent ev)voidmouseDragged(java.awt.event.MouseEvent ev)voidmouseEntered(java.awt.event.MouseEvent ev)voidmouseExited(java.awt.event.MouseEvent ev)voidmouseMoved(java.awt.event.MouseEvent ev)voidmousePressed(java.awt.event.MouseEvent ev)voidmouseReleased(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:
mousePressedin interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent ev)
- Specified by:
mouseReleasedin interfacejava.awt.event.MouseListener
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent ev)
- Specified by:
mouseMovedin 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:
mouseDraggedin interfacejava.awt.event.MouseMotionListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent ev)
- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent ev)
- Specified by:
mouseExitedin interfacejava.awt.event.MouseListener
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent ev)
- Specified by:
mouseClickedin 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 ofspotinwidth. 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.
-
-