Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

package graphics; import java.awt. * ; import java.awt.event. * ; public class DrawShapes extends Frame { public void paint ( Graphics g ) { /

package graphics;
import java.awt.*;
import java.awt.event.*;
public class DrawShapes extends Frame {
public void paint(Graphics g){// creates the content of the frame
Graphics2D ga =(Graphics2D) g;
ga.setPaint(Color.RED);
ga.drawOval(150,50,100,100);
ga.setColor(Color.BLUE);
ga.fillOval(175,150,100,100);
ga.setPaint(Color.GREEN);
ga.drawRect(50,200,100,100);
ga.setColor(Color.YELLOW);
ga.fillRect(175,200,100,100);
ga.setColor(Color.MAGENTA);
ga.setStroke(new BasicStroke(3));
ga.drawLine(50,350,275,350);
}
public static void main(String args[]){
DrawShapes frame = new DrawShapes(); // frame is the new object
frame.addWindowListener(new WindowAdapter(){// to receive window events
public void windowClosing(WindowEvent we){// when window is closed
System.exit(0);
}
});
frame.setSize(350,400); // sets size
frame.setVisible(true); // makes it visible
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Shouhong Wang, Hai Wang

1st Edition

1612330150, 978-1612330150

More Books

Students also viewed these Databases questions

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago

Question

What are the main differences between rigid and flexible pavements?

Answered: 1 week ago

Question

What is the purpose of a retaining wall, and how is it designed?

Answered: 1 week ago

Question

How do you determine the load-bearing capacity of a soil?

Answered: 1 week ago

Question

what is Edward Lemieux effect / Anomeric effect ?

Answered: 1 week ago

Question

3. Evaluate your listeners and tailor your speech to them

Answered: 1 week ago