Co-ordinates
To specify the position of
something on a flat surface we need to give two numbers: the horizontal distance from the
origin and the vertical distance.

As can be see in the figure above, by default, the
origin of the Java graphics co-ordinate system is in the top-left corner of the object
being drawn. This means that the position specified when both numbers are zero is the
top-left corner of the graphics context (usually this is the same as the top-left corner
of the component).
By convention we often refer to the horizontal position as
the ‘x co-ordinate' and the vertical position as the ‘y co-ordinate'.
The positions are measured in pixels by default. An
implication of measuring in pixels is that a program may produce a display which fits
easily on the screen on one system, but is too big on another. Ideally a program should be
able to scale its display to match the current screen, or provide scroll bars or some
other facility for managing large displays.
Back to top

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