Essay
import javax.swing.*;
import java.awt.*;
import java.awt.Color;
public class JDemoRectangles extends JFrame
{
Container con = getContentPane();
public JDemoRectangles()
{
con.setBackground(Color.BLUE);
con.setLayout(new FlowLayout());
}
public void paint(Graphics gr)
{
super.paint(gr);
gr.setColor(Color.RED);
gr.fillRect(40, 40, 120, 120);
gr.setColor(Color.YELLOW);
gr.fillRect(80, 80, 160, 160);
gr.clearRect(50, 60, 50, 50);
}
public static void main(String[] args)
{
JDemoRectangles frame = new JDemoRectangles();
frame.setSize(200, 200);
frame.setVisible(true);
}
}
Using the above code, describe what objects are drawn using the shaded statements of the paint() method.
Correct Answer:

Verified
In the paint() method, the first shaded ...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
Q6: The _ method draws what appears to
Q18: What are the constructors for the Dimension
Q23: A rectangle created with the clearRect() method
Q36: The _ method allows you to draw
Q37: A rectangle is drawn with the following
Q40: Write the statement to position a JLabel
Q41: Match each term with the correct statement
Q48: The _ method provides information about the
Q49: You use the _ method in statements
Q52: Which of the following statements will correctly