This topic contains a solution. Click here to go to the answer

Author Question: Fill in the code in the underlined location to display the mouse point location when the mouse is ... (Read 74 times)

mpobi80

  • Hero Member
  • *****
  • Posts: 519

Question 1

To handle the mouse click event on a pane p, register the handler with p using ________.
◦ p.setOnMouseDragged(handler);
◦ p.setOnMousePressed(handler);
◦ p.setOnMouseClicked(handler);
◦ p.setOnMouseReleased(handler);

Question 2

Fill in the code in the underlined location to display the mouse point location when the mouse is pressed in the pane.

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;

public class Test extends Application {
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
Pane pane = new Pane();
________

Scene scene = new Scene(pane, 200, 250);
primaryStage.setTitle("Test"); // Set the stage title
primaryStage.setScene(scene); // Place the scene in the stage
primaryStage.show(); // Display the stage
}

/**
* The main method is only needed for the IDE with limited JavaFX
* support. Not needed for running from the command line.
*/
public static void main(String[] args) {
launch(args);
}
}

◦ pane.setOnMouseClicked((e) -> System.out.println(e.getX() + ", " + e.getY()));
◦ pane.setOnMousePressed(e -> System.out.println(e.getX() + ", " + e.getY()));
◦ pane.setOnMouseReleased(e -> {System.out.println(e.getX() + ", " + e.getY())});
◦ pane.setOnMouseDragged((e) -> System.out.println(e.getX() + ", " + e.getY()));


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by mpobi80 on May 6, 2020

nmyers

  • Sr. Member
  • ****
  • Posts: 336
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 49% of students answer this correctly




mpobi80

  • Member
  • Posts: 519
Reply 2 on: May 6, 2020
YES! Correct, THANKS for helping me on my review


31809pancho

  • Member
  • Posts: 317
Reply 3 on: Yesterday
Excellent

 

Did you know?

During pregnancy, a woman is more likely to experience bleeding gums and nosebleeds caused by hormonal changes that increase blood flow to the mouth and nose.

Did you know?

Amphetamine poisoning can cause intravascular coagulation, circulatory collapse, rhabdomyolysis, ischemic colitis, acute psychosis, hyperthermia, respiratory distress syndrome, and pericarditis.

Did you know?

Throughout history, plants containing cardiac steroids have been used as heart drugs and as poisons (e.g., in arrows used in combat), emetics, and diuretics.

Did you know?

Blastomycosis is often misdiagnosed, resulting in tragic outcomes. It is caused by a fungus living in moist soil, in wooded areas of the United States and Canada. If inhaled, the fungus can cause mild breathing problems that may worsen and cause serious illness and even death.

Did you know?

On average, someone in the United States has a stroke about every 40 seconds. This is about 795,000 people per year.

For a complete list of videos, visit our video library