Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started