下面列出了java.awt.Cursor#MOVE_CURSOR 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public int getCursor(MouseEvent me) {
Component c = me.getComponent();
int w = c.getWidth();
int h = c.getHeight();
for (int i = 0; i < locations.length; i++) {
Rectangle rect = getRectangle(0, 0, w, h, locations[i]);
if (rect.contains(me.getPoint())) {
return cursors[i];
}
}
return Cursor.MOVE_CURSOR;
}
protected Cursor getObject() {
return new Cursor(Cursor.MOVE_CURSOR);
}
protected Cursor getObject() {
return new Cursor(Cursor.MOVE_CURSOR);
}
protected Cursor getObject() {
return new Cursor(Cursor.MOVE_CURSOR);
}
protected Cursor getObject() {
return new Cursor(Cursor.MOVE_CURSOR);
}
protected Cursor getObject() {
return new Cursor(Cursor.MOVE_CURSOR);
}
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();
}
protected Cursor getObject() {
return new Cursor(Cursor.MOVE_CURSOR);
}
protected Cursor getObject() {
return new Cursor(Cursor.MOVE_CURSOR);
}
protected Cursor getObject() {
return new Cursor(Cursor.MOVE_CURSOR);
}
protected Cursor getObject() {
return new Cursor(Cursor.MOVE_CURSOR);
}
protected Cursor getObject() {
return new Cursor(Cursor.MOVE_CURSOR);
}
protected Cursor getObject() {
return new Cursor(Cursor.MOVE_CURSOR);
}
protected Cursor getObject() {
return new Cursor(Cursor.MOVE_CURSOR);
}
protected Cursor getObject() {
return new Cursor(Cursor.MOVE_CURSOR);
}