use of java.awt.Cursor in project jna by java-native-access.
the class DragHandler method updateCursor.
/**
* Hook to update the cursor on various {@link DragSourceEvent} updates.
* @param ev event
*/
protected void updateCursor(DragSourceEvent ev) {
if (!fixCursor)
return;
Cursor cursor = getCursorForAction(adjustDropAction(ev));
ev.getDragSourceContext().setCursor(cursor);
}
use of java.awt.Cursor in project jna by java-native-access.
the class DragHandler method dragGestureRecognized.
/** Called when a user drag gesture is recognized. This method is
* responsible for initiating the drag operation.
* @param e event
*/
public void dragGestureRecognized(DragGestureEvent e) {
if ((e.getDragAction() & supportedActions) != 0 && canDrag(e)) {
setModifiers(e.getTriggerEvent().getModifiersEx() & KEY_MASK);
Transferable transferable = getTransferable(e);
if (transferable == null)
return;
try {
Point srcOffset = new Point(0, 0);
Icon icon = getDragIcon(e, srcOffset);
Point origin = e.getDragOrigin();
// offset of the image origin from the cursor
imageOffset = new Point(srcOffset.x - origin.x, srcOffset.y - origin.y);
Icon dragIcon = scaleDragIcon(icon, imageOffset);
Cursor cursor = null;
if (dragIcon != null && DragSource.isDragImageSupported()) {
GraphicsConfiguration gc = e.getComponent().getGraphicsConfiguration();
e.startDrag(cursor, createDragImage(gc, dragIcon), imageOffset, transferable, this);
} else {
if (dragIcon != null) {
Point screen = dragSource.getLocationOnScreen();
screen.translate(origin.x, origin.y);
Point cursorOffset = new Point(-imageOffset.x, -imageOffset.y);
ghost = new GhostedDragImage(dragSource, dragIcon, getImageLocation(screen), cursorOffset);
ghost.setAlpha(ghostAlpha);
}
e.startDrag(cursor, transferable, this);
}
dragStarted(e);
moved = false;
e.getDragSource().addDragSourceMotionListener(this);
DragHandler.transferable = transferable;
} catch (InvalidDnDOperationException ex) {
if (ghost != null) {
ghost.dispose();
ghost = null;
}
}
}
}
use of java.awt.Cursor in project voltdb by VoltDB.
the class Grid method mouseMove.
/**
* Method declaration
*
*
* @param e
* @param x
* @param y
*/
public boolean mouseMove(Event e, int x, int y) {
if (y <= iRowHeight) {
int xb = x;
x += iX - iGridWidth;
int i = iColCount - 1;
for (; i >= 0; i--) {
if (x > -7 && x < 7) {
break;
}
x += iColWidth[i];
}
if (i >= 0) {
if (!bDrag) {
setCursor(new Cursor(Cursor.E_RESIZE_CURSOR));
bDrag = true;
iXDrag = xb - iColWidth[i];
iColDrag = i;
}
return true;
}
}
return mouseExit(e, x, y);
}
use of java.awt.Cursor in project voltdb by VoltDB.
the class Grid method mouseExit.
/**
* Method declaration
*
*
* @param e
* @param x
* @param y
*/
public boolean mouseExit(Event e, int x, int y) {
if (bDrag) {
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
bDrag = false;
}
return true;
}
use of java.awt.Cursor in project android by JetBrains.
the class DeclaredDependenciesTableView method setHoveredDependency.
private void setHoveredDependency(@Nullable PsModuleDependency dependency) {
getListTableModel().setHoveredDependency(dependency);
Cursor cursor = getDefaultCursor();
if (dependency != null) {
cursor = getPredefinedCursor(HAND_CURSOR);
}
setCursor(cursor);
repaint();
}
Aggregations