Activity 3 — Understanding the co-ordinate system
(1) Suppose a simple Java program
draws a square whose centre is the centre of its window. That is, if the window is 100
pixels wide and 100 pixels high, the centre of the square and of the window is at position
x=50, y=50.
If the square is exactly 50 pixels wide and 50 pixels high,
what are the co-ordinates of each of its four corners?
You may find it helps to draw the square and the window on
paper first.
(2) write an applet to display a red square at these
co-ordinates and with a side length of 50.
Discussion of Activity 3
Back to Content
Back to top

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg |