Is there a way after the user presses the left click and drag something, after some amount of time or condition to release the left click? I don't want to consume the event, also if I disable the node the press is still there and the drag is still going, nor I want to remove the event, because another event is dependent on it. I just want the node to be released from the left click press.
可以将文章内容翻译成中文,广告屏蔽插件会导致该功能失效:
问题:
回答1:
For swing, you do it very similar to this, so it shouldn't be too far off for JavaFX
void drag(Point p) {
MouseEvent leftClick = new LeftClickEvent();//Substitute naming for proper instantiation
MouseEvent drag = new DragEvent(); //Substitute naming for proper instantiation
MouseEvent release = new ReleaseEvent(); //Substitute naming for proper instantiation
swing.processEvent(leftClick);
swing.processEvent(drag);
swing.processEvent(release);
}