Assume that g references a Graphics object. Write code that performs the following: a. Draws an outline
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 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 Answer:
Starting Out With Java From Control Structures Through Data Structures
ISBN: 9780133957051
6th Edition
Authors: Tony Gaddis