J2ME Learning Notes 1

xiaoxiao2021-03-14  226

Command

Use in the form class

Addcommand ("EXIT", Command.exit, 2); Addcommand (New Command ("Listen", Command.ok, 1); AddCommand (New Command ("STOP", Command.Stop, 1)) ;

Add Command, the third parameter is priority, affecting the location of the control.

Event Add

IMPLEMENTS COMMANDLISTENER interface must be implemented

And add event monitors setcommandListener (CommandListener i);

public void commandAction (Command command, Displayable displayable) {/ ** @todo Add command handling code * / if (command.getCommandType () == Command.EXIT) {// stop the MIDlet CMyMIDlet.quitApp ();} else if (Command.getCommandType () == command.ok) {// Display Something ~ this.setticker ("Running"));} else if (Command.getCommandType () == command.stop) {setticker (null }}}

LCIUI package is advanced API and low-level API

Advanced API includes: Schiki

Low-level API includes: Subclass and Graphics Class for Canvas

Ticker class, a graphic display, very funny, is to let a stuff have been scrolling on the form of Form

The sample code is as follows:

{

// if a is form instance

A.Setticker (New Ticker ("SomeStr");

a.setticker (null); // can cancel this stuff

}

转载请注明原文地址:https://www.9cbs.com/read-129430.html

New Post(0)