Just a quick question which is on my mind right now:
I have a JavaFX application that contains (among others) a ScrollPane and I need to capture the MouseClicked event of that ScrollPane. That itself is actually no problem, except that I only need to handle the event if the event target is an instance of a Rectangle, ToggleButton or a ScrollPaneSkin. That is actually quite easy, too, I know. Right now, I have the following code:
@FXML
void scrollPaneOnMouseClicked(MouseEvent event) {
System.out.println(event.getTarget().getClass().getName());
System.out.println(event.getTarget() instanceof ScrollPaneSkin);
if (event.getTarget() instanceof RoomRectangle || event.getTarget() instanceof ToggleButton || event.getTarget() instanceof ScrollPaneSkin) {
// handle
}
}
except that event.getTarget() instanceof ScrollPaneSkin
says false even if System.out.println(event.getTarget().getClass().getName());
outputs com.sun.javafx.scene.control.skin.ScrollPaneSkin$4
(and the debugger confirms that).
I also tried event.getTarget() instanceof ScrollPaneSkin$4
which resulted in a "cannot find symbol"-error.
What did I miss here?