Tooltip t = new Tooltip(); Tooltip.install(yournode, t); t.setOnShowing(ev -> {// called just prior to being shown Point mouse = java.awt.MouseInfo.getPointerInfo().getLocation(); Point2D local = yournode.screenToLocal(mouse.x, mouse.y); // my app-specific code to get the chart's yaxis value // then set the text as I want double pitch = yaxis.getValueForDisplay(local.getY()).doubleValue(); double freq = AudioUtil.pitch2frequency(pitch); t.setText(String.format("Pitch %.1f: %.1f Hz %.1f samples", pitch, freq, audio.rate / freq)); });
Tooltip t = new Tooltip(); Tooltip.install(yournode, t); t.setOnShowing(ev -> {// called just prior to being shown Point mouse = java.awt.MouseInfo.getPointerInfo().getLocation(); Point2D local = yournode.screenToLocal(mouse.x, mouse.y); // my app-specific code to get the char's yaxis value // then set the text as I want double pitch = yaxis.getValueForDisplay(local.getY()).doubleValue(); double freq = AudioUtil.pitch2frequency(pitch); t.setText(String.format("Pitch %.1f: %.1f Hz %.1f samples", pitch, freq, audio.rate / freq)); });
Tooltip t = new Tooltip(); Tooltip.install(yournode, t); t.setOnShowing(ev -> {// called just prior to being shown Point mouse = java.awt.MouseInfo.getPointerInfo().getLocation(); Point2D local = yournode.screenToLocal(mouse.x, mouse.y); // my app-specific code to get the chart's yaxis value // then set the text as I want double pitch = yaxis.getValueForDisplay(local.getY()).doubleValue(); double freq = AudioUtil.pitch2frequency(pitch); t.setText(String.format("Pitch %.1f: %.1f Hz %.1f samples", pitch, freq, audio.rate / freq)); });
java.setName("java"); Tooltip t = new Tooltip(); t.setOnShowing(e -> { Point2D screen = (Point2D) t.getProperties().get(MOUSE_TRIGGER_LOCATION); if (screen == null) return;