Ejemplo n.º 1
0
 public static CursorMode getCursorMode(java.awt.Cursor awtCursor) {
   switch (awtCursor.getType()) {
     case java.awt.Cursor.DEFAULT_CURSOR:
     default:
       return DEFAULT;
     case java.awt.Cursor.CROSSHAIR_CURSOR:
       return CROSS;
     case java.awt.Cursor.HAND_CURSOR:
       return HAND;
     case java.awt.Cursor.TEXT_CURSOR:
       return TEXT;
     case java.awt.Cursor.WAIT_CURSOR:
       return WAIT;
     case java.awt.Cursor.MOVE_CURSOR:
       return MOVE;
     case java.awt.Cursor.N_RESIZE_CURSOR:
       return RESIZE_NORTH;
     case java.awt.Cursor.NE_RESIZE_CURSOR:
       return RESIZE_NORTH_EAST;
     case java.awt.Cursor.E_RESIZE_CURSOR:
       return RESIZE_EAST;
     case java.awt.Cursor.SE_RESIZE_CURSOR:
       return RESIZE_SOUTH_EAST;
     case java.awt.Cursor.S_RESIZE_CURSOR:
       return RESIZE_SOUTH;
     case java.awt.Cursor.SW_RESIZE_CURSOR:
       return RESIZE_SOUTH_WEST;
     case java.awt.Cursor.W_RESIZE_CURSOR:
       return RESIZE_WEST;
     case java.awt.Cursor.NW_RESIZE_CURSOR:
       return RESIZE_NORTH_WEST;
   }
 }
Ejemplo n.º 2
0
 private void stopScanningForLinks() {
   if (isScanningForLinks) {
     Cursor c = getCursor();
     isScanningForLinks = false;
     if (c.getType() == Cursor.HAND_CURSOR) {
       setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
       repaint(); // TODO: Repaint just the affected line.
     }
   }
 }
Ejemplo n.º 3
0
  static javafx.scene.Cursor embedCursorToCursor(Cursor cursor) {
    if (cursor == null) {
      return javafx.scene.Cursor.DEFAULT;
    }

    switch (cursor.getType()) {
      case Cursor.DEFAULT_CURSOR:
        return javafx.scene.Cursor.DEFAULT;
      case Cursor.CROSSHAIR_CURSOR:
        return javafx.scene.Cursor.CROSSHAIR;
      case Cursor.E_RESIZE_CURSOR:
        return javafx.scene.Cursor.E_RESIZE;
      case Cursor.HAND_CURSOR:
        return javafx.scene.Cursor.HAND;
      case Cursor.MOVE_CURSOR:
        return javafx.scene.Cursor.MOVE;
      case Cursor.N_RESIZE_CURSOR:
        return javafx.scene.Cursor.N_RESIZE;
      case Cursor.NE_RESIZE_CURSOR:
        return javafx.scene.Cursor.NE_RESIZE;
      case Cursor.NW_RESIZE_CURSOR:
        return javafx.scene.Cursor.NW_RESIZE;
      case Cursor.S_RESIZE_CURSOR:
        return javafx.scene.Cursor.S_RESIZE;
      case Cursor.SE_RESIZE_CURSOR:
        return javafx.scene.Cursor.SE_RESIZE;
      case Cursor.SW_RESIZE_CURSOR:
        return javafx.scene.Cursor.SW_RESIZE;
      case Cursor.TEXT_CURSOR:
        return javafx.scene.Cursor.TEXT;
      case Cursor.W_RESIZE_CURSOR:
        return javafx.scene.Cursor.W_RESIZE;
      case Cursor.WAIT_CURSOR:
        return javafx.scene.Cursor.WAIT;
      default:
        return javafx.scene.Cursor.DEFAULT;
    }
  }
Ejemplo n.º 4
0
  /**
   * Set the canvas cursor, and remember the previous cursor on the cursor stack. Under the hood it
   * is mapping the java.awt.Cursor to org.eclipse.swt.graphics.Cursor objects.
   *
   * @param newCursor new cursor to push onto the cursor stack
   */
  public void pushCursor(final java.awt.Cursor newCursor) {
    Cursor swtCursor = null;
    if (newCursor.getType() == java.awt.Cursor.N_RESIZE_CURSOR) {
      swtCursor = new Cursor(getDisplay(), SWT.CURSOR_SIZEN);
    } else if (newCursor.getType() == java.awt.Cursor.NE_RESIZE_CURSOR) {
      swtCursor = new Cursor(getDisplay(), SWT.CURSOR_SIZENE);
    } else if (newCursor.getType() == java.awt.Cursor.NW_RESIZE_CURSOR) {
      swtCursor = new Cursor(getDisplay(), SWT.CURSOR_SIZENW);
    } else if (newCursor.getType() == java.awt.Cursor.S_RESIZE_CURSOR) {
      swtCursor = new Cursor(getDisplay(), SWT.CURSOR_SIZES);
    } else if (newCursor.getType() == java.awt.Cursor.SE_RESIZE_CURSOR) {
      swtCursor = new Cursor(getDisplay(), SWT.CURSOR_SIZESE);
    } else if (newCursor.getType() == java.awt.Cursor.SW_RESIZE_CURSOR) {
      swtCursor = new Cursor(getDisplay(), SWT.CURSOR_SIZESW);
    } else if (newCursor.getType() == java.awt.Cursor.E_RESIZE_CURSOR) {
      swtCursor = new Cursor(getDisplay(), SWT.CURSOR_SIZEE);
    } else if (newCursor.getType() == java.awt.Cursor.W_RESIZE_CURSOR) {
      swtCursor = new Cursor(getDisplay(), SWT.CURSOR_SIZEW);
    } else if (newCursor.getType() == java.awt.Cursor.TEXT_CURSOR) {
      swtCursor = new Cursor(getDisplay(), SWT.CURSOR_IBEAM);
    } else if (newCursor.getType() == java.awt.Cursor.HAND_CURSOR) {
      swtCursor = new Cursor(getDisplay(), SWT.CURSOR_HAND);
    } else if (newCursor.getType() == java.awt.Cursor.MOVE_CURSOR) {
      swtCursor = new Cursor(getDisplay(), SWT.CURSOR_SIZEALL);
    } else if (newCursor.getType() == java.awt.Cursor.CROSSHAIR_CURSOR) {
      swtCursor = new Cursor(getDisplay(), SWT.CURSOR_CROSS);
    } else if (newCursor.getType() == java.awt.Cursor.WAIT_CURSOR) {
      swtCursor = new Cursor(getDisplay(), SWT.CURSOR_WAIT);
    }

    if (swtCursor != null) {
      if (curCursor != null) {
        cursorStack.push(curCursor);
      }
      curCursor = swtCursor;
      setCursor(swtCursor);
    }
  }
Ejemplo n.º 5
0
 public String getJavaInitializationString() {
   if (current == null) return null; // no code to generate
   String cursorName = (String) CURSOR_CONSTANTS.get(new Integer(current.getType()));
   if (cursorName != null) return "new java.awt.Cursor (" + cursorName + ")"; // NOI18N
   return "new java.awt.Cursor (" + current.getType() + ")"; // NOI18N
 }