Consider the following code snippet: public class MyMouseListener
{
Public void mousePressed(MouseEvent event)
{
Double x;
Double y;
_______
System.out.println("x: " + x + ", y: " + y) ;
}
}
Which of the following statements should be in the indicated position to print out where the mouse was pressed?
A) x = event.getXposition() ; y = event.getYposition() ;
B) x = (MouseEvent) getX() ; y = (MouseEvent) getY() ;
C) x = event.printX() ; y = event.printY() ;
D) x = event.getX() ; y = event.getY() ;
Correct Answer:
Verified
Q75: A(n) _ has an instance method addActionListener()
Q76: How do you specify what the program
Q77: Use the _ method to add a
Q78: If the user presses and releases a
Q79: You have a class which extends the
Q80: Assuming that the ClickListener class implements the
Q81: Consider the following code snippet: class MouseClickedListener
Q82: A/an _ is used to capture mouse
Q83: You wish to detect when the mouse
Q85: What does the MouseAdapter class provide?
A) MouseAdapter
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents