Consider the following code snippet:
Public class MyMouseListener implements MouseListener
{
Public void mousePressed(MouseEvent event)
{
Double x;
Double y;
_______
System.out.println("x: " + x + ", y: " + y) ;
}
) . .
}
Which of the following statements should be filled in the blank 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
Q4: A complex GUI can be created with
Q15: What is the best first step in
Q43: What features do GUI builders have to
Q48: What is the most time-effective way to
Q49: Suppose a JPanel with a BorderLayout manager
Q52: Suppose a JPanel with a BorderLayout manager
Q63: Suppose a JPanel with a BorderLayout manager
Q72: Which of the following statements is correct?
A)new
Q77: Use the _ method to add a
Q82: The code below will not compile successfully
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