11.5. Drawing Primitives
The Graphics class provides various low-level drawing primitives. In general, drawing is started by calling the various methods of the Graphics object to set the color, translation, and clipping. Methods are available for drawing lines, various shapes, text, and Images. Each of the drawing primitives is explained next, along with a figure that illustrates their operation.
11.5.1. Drawing Lines
The Graphics.drawLine method draws a line from a starting point (x1,y1) to an ending point (x2,y2). The pixels are set to the value of the current color value. The lines are drawn with the current stroke style (see Section 11.3.5, “Line Styles.”)
drawLine(int x1, int y1, int x2, int y2)
Since a pixel extends below and to the right ...
Get Programming Wireless Devices with the Java™ 2 Platform, Micro Edition, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.