Examlex

Solved

Consider the Code Snippet Below: Public Class RectangleComponent Extends JComponent

question 5

Multiple Choice

Consider the code snippet below: public class RectangleComponent extends JComponent
{
Private Rectangle box;
Private static final int BOX_X = 100;
Private static final int BOX_Y = 100;
Private static final int BOX_WIDTH = 20;
Private static final int BOX_HEIGHT = 30;
Public RectangleComponent()
{
// The rectangle that the paint method draws
Box = new Rectangle(BOX_X, BOX_Y,
BOX_WIDTH, BOX_HEIGHT) ;
}
Public void paintComponent(GraphicsG) {
Super.paintComponent(g) ;
Graphics2D g2 = (Graphics2D) g;
G2) draw(box) ;
}
Public void moveTo(int x, int y)
{
box.setLocation(x, y) ;
Repaint() ;
}
}
Which statement causes the rectangle to appear at an updated location?


Definitions:

Negative Punishment

The removal of a desirable stimulus following unwanted behavior in order to decrease the likelihood of that behavior happening again.

Fender Bender

A minor car accident primarily resulting in cosmetic damage to the vehicle, without significant injuries to the involved parties.

Positive Punishment

The addition of an undesirable stimulus to decrease a behavior, such as adding chores for breaking rules.

Texting

The act of sending and receiving short written messages via mobile phone.

Related Questions