Question: Assume that g references a Graphics object. Write code that performs the following: a. Draws an outline of a rectangle that is 100 pixels wide

Assume that g references a Graphics object. Write code that performs the following:

a. Draws an outline of a rectangle that is 100 pixels wide by 200 pixels high, with its upper-left corner at (50,75).

b. Draws a filled rectangle that is 300 pixels wide by 100 pixels high, with its upper left corner at (10,90).

c. Draws a blue outline of an oval with an enclosing rectangle that is 100 pixels wide by 50 pixels high, with its upper-left corner at (10,25).

d. Draws a red line from (0,5) to (150,175).

e. Draws the string “Greetings Earthling”. The lower-left point of the string should be at (80,99). Use a bold, 20-point serif font.

f. Draws a polygon with vertices at the following points: (10,10), (10,25), (50,25), and (50,10). What shape does this code result in?  

Step by Step Solution

3.64 Rating (165 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is some code that performs the actions described in the question import javaawtColor import jav... View full answer

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 Starting Out With Java From Control Structures Questions!