HWW#4 Graphics




Problem 1:

Explain the differences between the following:

a)Cartesian coordinates and Java coordinates.

b)An RGB value and a color.

c)A graphics context and a component.

d)A mouse event and a mouse motion event.

e)A public and a protected element.

f)A private and a protected element

Problem 2:

Write Java statements to implement the following tasks. Where necessary, use g as a reference to the graphics context and panel as the name of the JPanel.

a)Move the default origin to a point that's displaced 50 pixels to the right and 200 pixels above the current origin location.

b)Draw a blue rectangle at location (10,10).

c)Paint a magenta oval at location (100,10).

d)Paint a red circle with diameter 100 at location (200,10).

e)Draw a 3D yellow rectangle at location (10,200).

f)Paint a white rounded rectangle at location (100,200).

g)Paint a black rounded rectangle at location (100,200).

h)Set a JPanel's size to 400x300.

i)Set a JPanel's foreground color to yellow and its background color to blue.