Class RadianceRootPaneUI.MouseInputHandler

java.lang.Object
org.pushingpixels.radiance.theming.internal.ui.RadianceRootPaneUI.MouseInputHandler
All Implemented Interfaces:
MouseListener, MouseMotionListener, EventListener, MouseInputListener
Enclosing class:
RadianceRootPaneUI

private class RadianceRootPaneUI.MouseInputHandler extends Object implements 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 Details

    • 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
  • Constructor Details

    • MouseInputHandler

      private MouseInputHandler()
  • Method Details

    • mousePressed

      public void mousePressed(MouseEvent ev)
      Specified by:
      mousePressed in interface MouseListener
    • mouseReleased

      public void mouseReleased(MouseEvent ev)
      Specified by:
      mouseReleased in interface MouseListener
    • mouseMoved

      public void mouseMoved(MouseEvent ev)
      Specified by:
      mouseMoved in interface MouseMotionListener
    • 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

      public void mouseDragged(MouseEvent ev)
      Specified by:
      mouseDragged in interface MouseMotionListener
    • mouseEntered

      public void mouseEntered(MouseEvent ev)
      Specified by:
      mouseEntered in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent ev)
      Specified by:
      mouseExited in interface MouseListener
    • mouseClicked

      public void mouseClicked(MouseEvent ev)
      Specified by:
      mouseClicked in interface MouseListener
    • calculateCorner

      private int calculateCorner(Window w, int x, int y)
      Returns the corner that contains the point x, 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 of spot in width. 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.