Motorola Inc.

i88s J2ME Developers’ Guide

/**

*Start running

*/

protected void startApp() {

myDisplay = Display.getDisplay(this); myOutput = new Form("Results");

myList = new List("Select test:", List.IMPLICIT, testList,

null);

okCommand = new Command("OK", Command.OK, 1); myOutput.addCommand(okCommand); myList.addCommand(okCommand); myOutput.setCommandListener(this); myList.setCommandListener(this);

tf1 = new TextBox("file to w/r", fileURL, 28, TextField.ANY); tf1.addCommand(okCommand); tf1.setCommandListener(this);

tf2 = new TextBox("Set Data to Send", stringNum, 28, TextField.ANY); tf2.addCommand(okCommand);

tf2.setCommandListener(this);

myDisplay.setCurrent(myList);

}

/**

*Stop running

*/

protected void pauseApp() {

}

/**

*Destroy App

*/

protected void destroyApp(boolean unconditional) {

}

/**

*Handle ok command

*/

public void commandAction(Command c, Displayable s) {

if (((s == tf1) (s == tf2)) && (c == okCommand)) { if(s==tf1) fileURL = tf1.getString(); if(s==tf2) {

/* data in the string form */ stringNum = tf2.getString();

/* convert the string into the integer form */ dataNum = stringNum.length();

}

}

if (s == myList) {

switch (((List)s).getSelectedIndex()) { case 0:

myDisplay.setCurrent(myOutput);

setFileName();

break;

case 1: myDisplay.setCurrent(myOutput); setData();

break;

case 2: myDisplay.setCurrent(myOutput);

Version 1.0 - Page 25

Page 25
Image 25
Motorola i88s manual Motorola Inc I88s J2ME Developers’ Guide