我试图在拖放过程中更改节点上的光标,但图像没有改变。我正在打电话setCursor()
in the DragDetectedEventHandler
我的节点。我也尝试过打电话getParent().setCursor()
并得到相同的结果。我还尝试在其他各种事件处理程序中执行此操作,例如鼠标按下和拖动。最好的情况是,我在释放鼠标按钮后使图像发生变化,但我需要图像在拖动过程中有所不同。有人知道怎么做吗?
private class DragDetectedEventHandler implements EventHandler<MouseEvent> {
@Override
public void handle(MouseEvent mouseEvent) {
System.out.println("Drag Detected");
Dragboard db = startDragAndDrop(TransferMode.MOVE);
ClipboardContent content = new ClipboardContent();
content.putString("sample-drag-text");
db.setContent(content);
setCursor(_imageCursor);
mouseEvent.consume();
}
}
Try
((Node) mouseEvent.getSource()).setCursor(Cursor.HAND);
如果不起作用,请发布包含 DragDetectedEventHandler 的完整类代码。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)