是否可以(以及如何)将工具提示直接应用于光标?
基本上是一个绑定(bind)到光标的弹出信息“框架”,几秒钟后就会消失。在应用程序窗口中的任何地方,工具提示都应跟随光标。
最佳答案
您可以执行以下操作:
Popup popup = new Popup();
popup.getContent().add(new Label("A tooltip"));
PauseTransition hideTimer = new PauseTransition(Duration.seconds(1));
hideTimer.setOnFinished(e -> popup.hide());
Scene scene = ... ;
scene.addEventFilter(MouseEvent.MOUSE_MOVED, e -> {
popup.show(scene.getRoot(), e.getScreenX(), e.getScreenY());
hideTimer.playFromStart();
});
关于java - 将(移动)工具提示应用于光标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41818132/