Essay
import javax.swing.*;
import java.awt.*;
import java.awt.Color;
public class JDemo3DRectangles extends JFrame
{
public void paint(Graphics gr)
{
super.paint(gr);
final int WIDTH = 60, HEIGHT = 80;
gr.setColor(Color.PINK);
gr.fill3DRect(20, 40, WIDTH, HEIGHT, true);
gr.fill3DRect(100, 40, WIDTH, HEIGHT, false);
}
public static void main(String[] args)
{
JDemo3DRectangles frame = new JDemo3DRectangles();
frame.setSize(180, 150);
frame.setVisible(true);
}
}
The highlighted code above creates two filled 3D rectangles. Describe how the color of the rectangles is set, and explain the five arguments that are used to draw the rectangles.
Correct Answer:

Verified
The fill3DRect() method is used for crea...View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q19: You can improve the appearance of strings
Q40: In the drawPolygon() method, what are the
Q45: BasicStroke myLine = new BasicStroke(12.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND);
Q46: To create an arc object named halfArc
Q47: The getFontMetrics() method can be used to
Q50: Match each term with the correct statement
Q52: If a window is 200 pixels wide
Q53: If you call getGraphics() in a frame
Q55: A Rectangle2D.Float can be created using five
Q63: The draw3DRect() method is used to draw