Java’s Coordinate System
To draw in Java, you must understand Java’s coordinate system (Fig. 4.17), a scheme for identifying points on the screen. By default, the upper-left corner of a GUI component has the coordinates (0, 0). A coordinate pair is composed of an x-coordinate (the horizontal coordinate) and a y-coordinate (the vertical coordinate). The x-coordinate is the horizontal location moving from left to right. The y-coordinate is the vertical location moving from top to bottom. The x-axis describes every horizontal coordinate, and the y-axis every vertical coordinate. Coordinates indicate where graphics should be displayed on a screen. Coordinate units are measured in pixels. The term pixel stands for “picture element.” A pixel is a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access