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
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q42: Write the statement to set the font
Q44: Write the statement to create an Arc2D.Float
Q47: BasicStroke myLine = new BasicStroke(12.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND);
Q52: The draw3DRect() method is used to draw
Q62: Write the statement to create a Rectangle2D.Float
Q65: import javax.swing.*;
import java.awt.*;
import java.awt.Color;
public class JDemoRectangles extends
Q66: Write the statement to instruct a Graphics
Q68: import javax.swing.*;
import java.awt.*;
public class JDemoFont extends JFrame
{
Font
Q70: Write the statement to position a JLabel
Q74: Write the statement to draw a rectangle
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