javax.swing.JComponent.getCursor()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(134)

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

JComponent.getCursor介绍

暂无

代码示例

代码示例来源:origin: protegeproject/protege

public void dragEnter(DropTargetDragEvent dtde) {
  orginalCursor = component.getCursor();
}

代码示例来源:origin: edu.stanford.protege/protege-editor-owl

public void dragEnter(DropTargetDragEvent dtde) {
  orginalCursor = component.getCursor();
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl

public void dragEnter(DropTargetDragEvent dtde) {
  orginalCursor = component.getCursor();
}

代码示例来源:origin: org.protege/protege-editor-owl

public void dragEnter(DropTargetDragEvent dtde) {
  orginalCursor = component.getCursor();
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Gets the cursor set in the component. If the component does not have a cursor set, the cursor of its parent is
 * returned. If no cursor is set in the entire hierarchy, <code>Cursor.DEFAULT_CURSOR</code> is returned.
 *
 * @see #setCursor
 * @since JDK1.1
 */
@Override
public Cursor getCursor() {
  if (isEnabled()) {
    return Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR);
  }
  else {
    return super.getCursor();
  }
}

代码示例来源: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: freeplane/freeplane

@Override
public void mousePressed(final MouseEvent e) {
  final JComponent component = (JComponent) e.getComponent();
  final int cursorType = component.getCursor().getType();
  if (cursorType == Cursor.SE_RESIZE_CURSOR) {
    final IViewerFactory factory = (IViewerFactory) component.getClientProperty(IViewerFactory.class);
    if (factory == null) {
      return;
    }
    final Point point = e.getPoint();
    setBasePoint(new Point (component.getWidth() - point.x, component.getHeight() - point.y));
    return;
  }
  else {
    imagePopupMenu.maybeShowPopup(e);
    return;
  }
}

代码示例来源:origin: khuxtable/seaglass

/**
 * {@inheritDoc}
 */
@Override
public void mouseMoved(MouseEvent e) {
  currentMouseX = e.getX();
  currentMouseY = e.getY();
  
  Cursor cursorToUse = Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR);
  if (isOverCancelButton() || isOverFindButton()) {
    cursorToUse = Cursor.getDefaultCursor();  
  }
  JComponent c = (JComponent) e.getSource();
  if (!cursorToUse.equals(c.getCursor())) {
    c.setCursor(cursorToUse);
  }
  super.mouseMoved(e);
}

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

@Override
public void onMousePressed(MouseEvent event) {
  if (event.getClickCount() > 1) {
    return;
  }
  if (event.getButton() != MouseEvent.BUTTON1) {
    return;
  }
  GraphTool selectedTool = this.selectionHandler.getSelectedTool();
  if (IEdge.class.isInstance(selectedTool.getNodeOrEdge())) {
    return;
  }
  double zoom = editorPart.getZoomFactor();
  final Point2D mousePoint = new Point2D.Double(event.getX() / zoom, event.getY() / zoom);
  if (isMouseOnNode(mousePoint)) {
    changeSelectedElementIfNeeded(mousePoint);
    this.isReadyForDragging = true;
    this.lastMousePoint = mousePoint;
    this.initialCursor = this.editorPart.getSwingComponent().getCursor();
    this.editorPart.getSwingComponent().setCursor(this.dragCursor);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-apisupport-project

/** Creates a new instance of SplashDnDSupport */
DragManager(JComponent component) {
  this.component = component;
  dSource =  new DragSource();
  dRecognizer = dSource.createDefaultDragGestureRecognizer(this.component,DnDConstants.ACTION_MOVE,this);
  dTarget = new DropTarget(this.component,DnDConstants.ACTION_MOVE,this);
  component.addMouseMotionListener(this);
  oCursor = component.getCursor();
}

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

private void setSize(final JComponent component, int x, int y) {
  final int cursorType = component.getCursor().getType();
  sizeChanged = true;
  final Dimension size;
  switch (cursorType) {
    case Cursor.SE_RESIZE_CURSOR:
      final Dimension minimumSize = new Dimension(10, 10);
      if (x <= 2*BORDER_SIZE || y <= 2*BORDER_SIZE) {
        return;
      }
      final double r = Math.sqrt(x * x + y * y);
      final Dimension preferredSize = ((ScalableComponent) component).getOriginalSize();
      final int width = preferredSize.width;
      final int height = preferredSize.height;
      final double r0 = Math.sqrt(width * width + height * height);
      x = (int) (width * r / r0);
      y = (int) (height * r / r0);
      final MapView mapView = (MapView) SwingUtilities.getAncestorOfClass(MapView.class, component);
      if (x < mapView.getZoomed(minimumSize.width) || y < mapView.getZoomed(minimumSize.height)) {
        return;
      }
      size = new Dimension(x, y);
      ((ScalableComponent) component).setDraftViewerSize(size);
      component.revalidate();
      break;
    default:
  }
  return;
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

cursor_ = s.getCursor();
s.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
values_ = v;

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-railsprojects

final String successMessage, final String failureMessage, final List<String> lines,
  final Runnable successCompletionTask, final String command, final String... commandArgs) {
final Cursor originalCursor = parent.getCursor();
Cursor busy = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
parent.setCursor(busy);

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

private boolean showNext(final MouseEvent e) {
  final int cursorType = component.getCursor().getType();
  if ((e.getClickCount() != 2) || (e.getButton() != MouseEvent.BUTTON1)
      || (cursorType == Cursor.SE_RESIZE_CURSOR)) {

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

@Override
public void onMouseMoved(MouseEvent event)
{
  if (!isPrerequisitesOK())
  {
    return;
  }
  boolean isMouseOnEdgePath = isMouseOnEdgePath(event);
  if (isMouseOnEdgePath)
  {
    if (this.initialCursor == null)
    {
      this.initialCursor = this.editorPart.getSwingComponent().getCursor();
    }
    this.editorPart.getSwingComponent().setCursor(this.transitionCursor);
  }
  if (!isMouseOnEdgePath)
  {
    if (this.initialCursor != null)
    {
      this.editorPart.getSwingComponent().setCursor(this.initialCursor);
      this.initialCursor = null;
    }
  }
}

相关文章

JComponent类方法