222k views
0 votes
Fill in the code in the underlined location to display the mouse point location when the mouse is pressed in the pane. pane.setOnMousePressed(e -> System.out.println(e.getX() + ", " + e.getY())); pane.setOnMouseDragged((e) -> System.out.println(e.getX() + ", " + e.getY())); pane.setOnMouseReleased(e -> {System.out.println(e.getX() + ", " + e.getY())}); pane.setOnMouseClicked((e) -> System.out.println(e.getX() + ", " + e.getY()));

User Nataraj
by
8.2k points

1 Answer

5 votes

Answer:

The correct option is pane.setOnMouseClicked((e) -> System.out.println(e.getX() + ", " + e.getY()));

Step-by-step explanation:

As the complete question is not provided, the complete question is attached herewith.

In order to handle the underlined location the way is to get the position using the MouseClicked event which will be activated when the mouse is clicked and then the values of X and Y position will be printed.

pane.setOnMouseClicked((e) -> System.out.println(e.getX() + ", " + e.getY()));

The other options are not correct as the handle used in them is not defined for this purpose.

Fill in the code in the underlined location to display the mouse point location when-example-1
User Ckot
by
6.4k points