您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)

 

Content Index

Content Page # 8

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.

image54.gif (2205 bytes)

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

basicline.gif (169 bytes)

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