Graphics Drawing

Undoubtedly, you noticed that the canvas in Figure 6.2 was blank except for the Exit soft button. The reason is that the Canvas1 class doesn't define its visual representation. All concrete subclasses of Canvas must define their look in order to render any visual attributes. They must enlist the help of the javax.microedition.lcdui.Graphics class to do so. The very purpose of the Graphics class is to support drawing on canvases.

The Graphics Model

The Graphics class defines low-level graphics drawing capabilities. If you've already done AWT or Swing development, this class will look very familiar. In fact, its features and API are almost identical to, albeit a subset of, those in the J2SE Graphics class.

The Graphics class defines ...

Get Wireless J2ME™ Platform Programming 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.