Question: Intro to java please see below thank you! .4. Draw three rectangles in a row, like this: Call the translate method twice. DrawingComponent.java I ?Tport
Intro to java please see below thank you!

.4. Draw three rectangles in a row, like this: Call the translate method twice. DrawingComponent.java I ?Tport java.awt.Graphics; 2 import java.awt.Graphics2D; 3 ?Tport java . awt. Rectangle; 4 import javax. swing. JCorponent; 6 public class DrawingComponent extends JComponent 8 public void paintComponent (Graphics g) I/ Recover Graphics2D Graphics2D g2 - (Graphics2D) g: 12 Rectangle box new Rectangle(5, 10, 28, 3); 14 15 16 DrawingViewer java 1 iport javax.swing.*; 3 public class DrawingViewer 5 public static void main(Stringll args) JFrame frame new JFrame(); frane.setSize(300, 400); frane.setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE); 10 new DrawingComponent ); 12 13 14 15 16 17 DrawingComponent component frane.add (component); frane.setVisible(true)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
