@Override
  public void mouseMoved(MouseEvent e) {
    Component source = e.getComponent();
    Point location = e.getPoint();
    direction = 0;

    if (location.x < dragInsets.left) direction += WEST;

    if (location.x > source.getWidth() - dragInsets.right - 1) direction += EAST;

    if (location.y < dragInsets.top) direction += NORTH;

    if (location.y > source.getHeight() - dragInsets.bottom - 1) direction += SOUTH;

    //  Mouse is no longer over a resizable border

    if (direction == 0) {
      source.setCursor(sourceCursor);
    } else // use the appropriate resizable cursor
    {
      int cursorType = cursors.get(direction);
      Cursor cursor = Cursor.getPredefinedCursor(cursorType);
      source.setCursor(cursor);
    }
  }
예제 #2
0
 /**
  * Long operations need to display an hourglass.
  *
  * @param comp The <code>JComponent</code> on which to apply the hour glass cursor
  * @param on If true, we set the cursor on the hourglass
  */
 public static void setCursorOnWait(Component comp, boolean on) {
   if (on) {
     if (comp instanceof AbstractEditorPanel) ((AbstractEditorPanel) comp).showWaitCursor();
     else comp.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
   } else {
     if (comp instanceof AbstractEditorPanel) ((AbstractEditorPanel) comp).hideWaitCursor();
     else comp.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
   }
 }
 @Override
 public void mouseExited(MouseEvent e) {
   if (!resizing) {
     Component source = e.getComponent();
     source.setCursor(sourceCursor);
   }
 }
  /** Restore the original state of the Component */
  @Override
  public void mouseReleased(MouseEvent e) {
    resizing = false;

    Component source = e.getComponent();
    source.setCursor(sourceCursor);

    if (source instanceof JComponent) {
      ((JComponent) source).setAutoscrolls(autoscrolls);
    }
  }