Question: Draw three rectangles inside each other, like in the picture. please share the screenshot of the output and use comments in code CoursHeroTranscribedText DrawingComponent.java 1

Draw three rectangles inside each other, like in the picture.

please share the screenshot of the output and use comments in code

DrawingComponent.java 1 import java.awt.Graphics; 2 import javax.swing.J Component; 123456700 public class DrawingComponentextends Component 5 { 1 1 } public void paintComponent (Graphics g)

CoursHeroTranscribedText

DrawingComponent.java 1 import java.awt.Graphics; 2 import javax.swing.J Component; 123456700 public class DrawingComponent extends Component 5 { 1 1 } public void paintComponent (Graphics g) { } g.drawRectangle(100, 100, 20, 30); // Innermost rectangle DrawingViewer.java 1 import javax.swing.*; 2 3 public class DrawingViewer 40 public static void main(String[] args) JFrame frame = new JFrame(); frame.setSize(300, 400); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); frame.add(component); 1 1 DrawingComponent component = new DrawingComponent(); 1 1 frame.setVisible(true); 1 } 1}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!