當前位置: 首頁>>代碼示例>>Java>>正文


Java Cursor.MOVE_CURSOR屬性代碼示例

本文整理匯總了Java中java.awt.Cursor.MOVE_CURSOR屬性的典型用法代碼示例。如果您正苦於以下問題:Java Cursor.MOVE_CURSOR屬性的具體用法?Java Cursor.MOVE_CURSOR怎麽用?Java Cursor.MOVE_CURSOR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.awt.Cursor的用法示例。


在下文中一共展示了Cursor.MOVE_CURSOR屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setCursor

static void setCursor(int c, Object display) {
  Container d = (Container) display;
  switch (c) {
  case JmolConstants.CURSOR_HAND:
    c = Cursor.HAND_CURSOR;
    break;
  case JmolConstants.CURSOR_MOVE:
    c = Cursor.MOVE_CURSOR;
    break;
  case JmolConstants.CURSOR_ZOOM:
    c = Cursor.N_RESIZE_CURSOR;
    break;
  case JmolConstants.CURSOR_CROSSHAIR:
    c = Cursor.CROSSHAIR_CURSOR;
    break;
  case JmolConstants.CURSOR_WAIT:
    c = Cursor.WAIT_CURSOR;
    break;
  default:
    d.setCursor(Cursor.getDefaultCursor());
    return;
  }
  d.setCursor(Cursor.getPredefinedCursor(c));
}
 
開發者ID:etomica,項目名稱:etomica,代碼行數:24,代碼來源:Display.java

示例2: mouseMoved

public void mouseMoved(Point point) {
    synchronized (mouseLock) {
        if (mousePressedPosition != null)
            mouseDragPosition = point;

        Bounds bounds = getSelected(point);
        int cursorType;
        if (bounds == null)
            cursorType = Cursor.DEFAULT_CURSOR;
        else {
            cursorType = Cursor.MOVE_CURSOR;
        }
        if (selection.getBounds().length == 1) {

            boolean resizableX = selection.isResizeableX(diagram);
            boolean resizableY = selection.isResizeableY(diagram);

            if ((resizableX) && (isRightMove(point)))
                cursorType = Cursor.E_RESIZE_CURSOR;
            else if ((resizableX) && (isLeftMove(point)))
                cursorType = Cursor.W_RESIZE_CURSOR;
            else if ((resizableY) && (isTopMove(point)))
                cursorType = Cursor.N_RESIZE_CURSOR;
            else if ((resizableY) && (isBottomMove(point)))
                cursorType = Cursor.S_RESIZE_CURSOR;
            else if ((resizableY) && (resizableX)
                    && (isRightBottomMove(point)))
                cursorType = Cursor.SE_RESIZE_CURSOR;
            else if ((resizableY) && (resizableX)
                    && (isLeftBottomMove(point)))
                cursorType = Cursor.SW_RESIZE_CURSOR;
            else if ((resizableY) && (resizableX)
                    && (isTopRightMove(point)))
                cursorType = Cursor.NE_RESIZE_CURSOR;
            else if ((resizableY) && (resizableX) && (isTopLeftMove(point)))
                cursorType = Cursor.NW_RESIZE_CURSOR;

        }

        if (this.cursorType != cursorType) {
            this.cursorType = cursorType;
            this.setCursor(new Cursor(cursorType));
        }

    }
    repaint();
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:47,代碼來源:GEFComponent.java

示例3: getObject

protected Cursor getObject() {
    return new Cursor(Cursor.MOVE_CURSOR);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:3,代碼來源:java_awt_Cursor.java


注:本文中的java.awt.Cursor.MOVE_CURSOR屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。