9. Creating Custom Screens
IF the plain old LCDUI screens are not sufficiently jazzy or flexible for your application, you can create your own screen using a canvas. It’s more work, but it’s more fun. You can control almost all of the drawing on the display and you get fine-grained event information as well.
The Canvas
class is a lot like the other screens, a descendent of the Displayable
class. This means that it can have commands, a title, and a ticker.
You can’t just create a canvas directly, as you can with other screens. Canvas
is an abstract class, with a single abstract method, paint()
. You must write a subclass of Canvas
and define a paint()
method that draws whatever you want. Then you can create an instance of your canvas and show it ...
Get Kicking Butt with MIDP and MSA: Creating Great Mobile Applications 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.