Java Reference
In-Depth Information
public class Pacer
extends MIDlet{
public void startApp() {
Displayable d = new PacerCanvas();
d.addCommand(new Command("Exit", Command.EXIT, 0));
d.setCommandListener(new CommandListener() {
public void commandAction(Command c, Displayable s) {
notifyDestroyed();
}
} );
Display.getDisplay(this).setCurrent(d);
}
public void pauseApp() { }
public void destroyApp(boolean unconditional) { }
}
When you run Pacer in the Wireless Toolkit emulator, it looks like Figure 13-2.
Figure 13-2. Playing around with Graphics
Working with Color
The Graphics class maintains a current drawing color that is used for drawing shape outlines,
filling shapes, and drawing text. Colors are represented as combinations of red, green, and
blue, with 8 bits for each color component. You can set the current drawing color using the
following method:
public void setColor(int RGB)
 
Search WWH ::




Custom Search