java.awt.Cursor.getType()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(206)

本文整理了Java中java.awt.Cursor.getType()方法的一些代码示例,展示了Cursor.getType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cursor.getType()方法的具体详情如下:
包路径:java.awt.Cursor
类名称:Cursor
方法名:getType

Cursor.getType介绍

[英]Returns the type for this cursor.
[中]返回此游标的类型。

代码示例

代码示例来源:origin: deathmarine/Luyten

@Override
public synchronized void mouseMoved(MouseEvent e) {
  String linkText = null;
  boolean isLinkLabel = false;
  boolean isCtrlDown = (e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0;
  if (isCtrlDown) {
    linkText = createLinkLabel(e);
    isLinkLabel = linkText != null;
  }
  if (isCtrlDown && isWaitForLinksCursor) {
    textArea.setCursor(new Cursor(Cursor.WAIT_CURSOR));
  } else if (textArea.getCursor().getType() == Cursor.WAIT_CURSOR) {
    textArea.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
  }
  JLabel label = OpenFile.this.mainWindow.getLabel();
  if (isLinkLabel && isLinkLabelPrev) {
    if (!linkText.equals(prevLinkText)) {
      setLinkLabel(label, linkText);
    }
  } else if (isLinkLabel && !isLinkLabelPrev) {
    setLinkLabel(label, linkText);
  } else if (!isLinkLabel && isLinkLabelPrev) {
    setLinkLabel(label, null);
  }
  isLinkLabelPrev = isLinkLabel;
  prevLinkText = linkText;
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Ensures that the cursor for this component is appropriate for the
 * orientation.
 *
 * @param ltr Whether the current component orientation is LTR.
 */
protected void possiblyFixCursor(boolean ltr) {
  int cursor = Cursor.NE_RESIZE_CURSOR;
  if (ltr) {
    cursor = Cursor.NW_RESIZE_CURSOR;
  }
  if (cursor!=getCursor().getType()) {
    setCursor(Cursor.getPredefinedCursor(cursor));
  }
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Resets the editor state after the user clicks on a hyperlink or releases
 * the hyperlink modifier.
 */
private void stopScanningForLinks() {
  if (isScanningForLinks) {
    Cursor c = getCursor();
    isScanningForLinks = false;
    linkGeneratorResult = null;
    hoveredOverLinkOffset = -1;
    if (c!=null && c.getType()==Cursor.HAND_CURSOR) {
      setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
      repaint(); // TODO: Repaint just the affected line.
    }
  }
}

代码示例来源:origin: stackoverflow.com

Cursor currentViewCursor = aJPanel.getCursor();

 assertCursorsEquals(currentViewCursor, myListenerClass.getCursorForIcon(iconName));

}

private void assertCursorsEquals( Cursor a, Cursor b){
 assertEquals(a.getType(), b.getType());
 ...//other checks you care about

}

代码示例来源:origin: stackoverflow.com

Cursor cur = ...

if (cursor != null) {
  while (cursor.moveToNext()) {
    String name = cur.getColumnName(i);
    int type = cur.getType(i);
    ...
  }
}

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

public void mouseClicked(MouseEvent e)
  {
   if(2 == e.getClickCount() && _tableHeader.getCursor().getType() == Cursor.E_RESIZE_CURSOR)
   {
     onMouseDraggedOnTableHeader(e);
   }
  }
});

代码示例来源:origin: JChemPaint/jchempaint

/**
 * Tells the mouse cursor shown on the renderPanel.
 * 
 * @return One of the constants from java.awt.Cursor.
 */
public int getCursor() {
  return eventRelay.getCursor().getType();
}

代码示例来源:origin: realXuJiang/bigtable-sql

public void mouseClicked(MouseEvent e)
  {
   if(2 == e.getClickCount() && _tableHeader.getCursor().getType() == Cursor.E_RESIZE_CURSOR)
   {
     onMouseDraggedOnTableHeader(e);
   }
  }
});

代码示例来源:origin: freeplane/freeplane

@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
  if (c.getCursor().getType() == Cursor.SE_RESIZE_CURSOR) {
    Color oldColor = g.getColor();
    g.translate(x, y);
    g.setColor(borderColor);
    g.fillRect(0, 0, width - borderWidth, borderWidth);
    g.fillRect(0, borderWidth, borderWidth, height - borderWidth);
    g.fillRect(borderWidth, height - borderWidth, width - borderWidth, borderWidth);
    g.fillRect(width - borderWidth, 0, borderWidth, height - borderWidth);
    g.translate(-x, -y);
    g.setColor(oldColor);
  }
}

代码示例来源:origin: nu.zoom.svansprogram/svansprogram-cursorswitcher

@Override
public synchronized void cancelScheduleAndSetDefaultCursor(JComponent component) {
  TimerTask task = componentTasks.get(component);
  if (task != null) {
    task.cancel();
    componentTasks.remove(component);
  }
  if (component.getCursor().getType() == Cursor.WAIT_CURSOR) {
    component.setCursor(Cursor.getDefaultCursor());
  }
}

代码示例来源:origin: tinyMediaManager/tinyMediaManager

@Override
public void mouseMoved(MouseEvent e) {
 JTable table = (JTable) e.getSource();
 int col = table.columnAtPoint(new Point(e.getX(), e.getY()));
 if (col != 0 && table.getCursor().getType() == Cursor.HAND_CURSOR) {
  table.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
 }
 if (col == 0 && table.getCursor().getType() == Cursor.DEFAULT_CURSOR) {
  table.setCursor(new Cursor(Cursor.HAND_CURSOR));
 }
}

代码示例来源:origin: freeplane/freeplane

private void setCursor(final Component component, final int cursorType) {
  final Cursor cursor = component.getCursor();
  if (cursor.getType() != cursorType) {
    final Cursor predefinedCursor = cursorType == Cursor.DEFAULT_CURSOR ? null : Cursor
      .getPredefinedCursor(cursorType);
    component.setCursor(predefinedCursor);
  }
  ViewerBorder.repaintBorder((JComponent) component);
}

代码示例来源:origin: tinyMediaManager/tinyMediaManager

@Override
public void mouseMoved(MouseEvent e) {
 JTable table = (JTable) e.getSource();
 int col = table.columnAtPoint(new Point(e.getX(), e.getY()));
 if (col != 0 && table.getCursor().getType() == Cursor.HAND_CURSOR) {
  table.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
 }
 if (col == 0 && table.getCursor().getType() == Cursor.DEFAULT_CURSOR) {
  table.setCursor(new Cursor(Cursor.HAND_CURSOR));
 }
}

代码示例来源:origin: tinyMediaManager/tinyMediaManager

@Override
public void mouseMoved(MouseEvent e) {
 JTable table = (JTable) e.getSource();
 int col = table.columnAtPoint(new Point(e.getX(), e.getY()));
 if (col != 0 && table.getCursor().getType() == Cursor.HAND_CURSOR) {
  table.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
 }
 if (col == 0 && table.getCursor().getType() == Cursor.DEFAULT_CURSOR) {
  table.setCursor(new Cursor(Cursor.HAND_CURSOR));
 }
}

代码示例来源:origin: tinyMediaManager/tinyMediaManager

@Override
public void mouseMoved(MouseEvent e) {
 JTable table = (JTable) e.getSource();
 int col = table.columnAtPoint(new Point(e.getX(), e.getY()));
 if (col != 0 && col != 1 && table.getCursor().getType() == Cursor.HAND_CURSOR) {
  table.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
 }
 if ((col == 0 || col == 1) && table.getCursor().getType() == Cursor.DEFAULT_CURSOR) {
  table.setCursor(new Cursor(Cursor.HAND_CURSOR));
 }
}

代码示例来源:origin: freeplane/freeplane

public void setMoveCursor(final boolean isHand) {
  final int requiredCursor = isHand ? Cursor.MOVE_CURSOR : Cursor.DEFAULT_CURSOR;
  if (getCursor().getType() != requiredCursor) {
    setCursor(requiredCursor != Cursor.DEFAULT_CURSOR ? new Cursor(requiredCursor) : null);
  }
}

代码示例来源:origin: Cool-Coding/remote-desktop-control

@Override
public void mouseReleased(MouseEvent e) {
    if(e.getComponent().getCursor().getType()==Cursor.HAND_CURSOR) {
      e.getComponent().setCursor(Cursor.getDefaultCursor());
    }
    final MasterMouseEvent mouseEvent = new MasterMouseEvent();
    mouseEvent.mouseReleased(e.getButton());
    LOGGER.debug("mouse released:{}", mouseEvent.getMouseButton());
    sendMosueEvent(mouseEvent);
}

代码示例来源:origin: org.apache.xmlgraphics/batik-swing

public void mouseEntered(GraphicsNodeMouseEvent evt) {
  if (evt.getSource() instanceof Selectable) {
    textSelector.mouseEntered(evt);
    previousCursor = component.getCursor();
    if (previousCursor.getType() == Cursor.DEFAULT_CURSOR) {
      component.setCursor(TEXT_CURSOR);
    }
  }
}

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

public void mouseEntered(GraphicsNodeMouseEvent evt) {
  if (evt.getSource() instanceof Selectable) {
    textSelector.mouseEntered(evt);
    previousCursor = component.getCursor();
    if (previousCursor.getType() == Cursor.DEFAULT_CURSOR) {
      component.setCursor(TEXT_CURSOR);
    }
  }
}

代码示例来源:origin: apache/batik

public void mouseEntered(GraphicsNodeMouseEvent evt) {
  if (evt.getSource() instanceof Selectable) {
    textSelector.mouseEntered(evt);
    previousCursor = component.getCursor();
    if (previousCursor.getType() == Cursor.DEFAULT_CURSOR) {
      component.setCursor(TEXT_CURSOR);
    }
  }
}

相关文章