Multiple Choice
Consider the code snippet below:
Public class RectangleComponent extends JComponent
{
Private static final int RECTANGLE_WIDTH = 20;
Private static final int RECTANGLE_HEIGHT = 30;
Private int xLeft;
Private int yTop;
Public RectangleComponent()
{
xLeft = 0;
yTop = 0;
}
Public void paintComponent(Graphics g) {
g.fillRect(xLeft, yTop, RECTANGLE_WIDTH, RECTANGLE_HEIGHT) ;
}
Public void moveRectangleBy(int dx, int dy)
{
xLeft = xLeft + dx;
yTop = yTop + dy;
repaint() ;
}
}
Which statement(s) causes the rectangle to appear at an updated location?
A) repaint() ;
B) public void moveRectangleBy(int dx, int dy) ;
C) xLeft = xLeft + dx;
YTop = yTop + dy;
D) xLeft = 0;
yTop = 0;
Correct Answer:

Verified
Correct Answer:
Verified
Q1: To create a _ layout, you supply
Q7: Consider the following code snippet:<br>Public class MyMouseListener
Q9: Consider the following code snippet:<br>Class MyListener implements
Q24: For a new programmer using the Swing
Q28: Which of the following is not a
Q29: Suppose listener is an instance of a
Q45: Which layout manager places objects left-to-right, row
Q48: A _ is a combination of a
Q58: What is the best way to discover
Q72: What is known for certain from this