Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the code snippet below: public class RectangleComponent extends JComponent { private static final int RECTANGLE_WIDTH = 20; private static final int RECTANGLE_HEIGHT = 30;

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; getGraphics().setColor(Color.green); repaint(); } } 

Which color will be used to fill a rectangle in paintComponent?

green
the system's default color
white
it is impossible to specify

Flag this Question

Question 2 0.1 pts

If you need force the screen to be updated, you should call the method ____.

draw 
update 
paintComponent 
repaint 

Flag this Question

Question 3 0.1 pts

Complete the following statement to construct a rectangle.

Graphics g; g.____________________ (x, y, width, height); 
drawRect 
drawOval 
fillCircle 
DrawOval 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems X Special Issue On Database And Expert Systems Applications Lncs 8220

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2013th Edition

ISBN: 3642412203, 978-3642412202

More Books

Students also viewed these Databases questions

Question

Decision Making in Groups Leadership in Meetings

Answered: 1 week ago