Java Reference
In-Depth Information
public class SMSMIDlet
extends MIDlet
implements CommandListener, Runnable {
private Sender mSender = null;
private Thread mReceiver = null;
private Command mExitCommand = new Command("Exit", Command.EXIT, 2);
private Command mRedCommand = new Command("Send Red", Command.SCREEN, 1);
private Command mBlueCommand = new Command("Send Blue", Command.SCREEN, 1);
private Display mDisplay = null;
protected ImageItem mColorSquare = null;
protected Image [] mImages = new Image[2];
protected Image waitImage = null;
private String mPort = "1234";
private TextField mNumberEntry= null;
private Form mForm = null;
private String mSenderAddress = null;
public SMSMIDlet() {
mSender = Sender.getInstance();
}
public void commandAction(javax.microedition.lcdui.Command c,
javax.microedition.lcdui.Displayable d) {
if (c == mExitCommand) {
if (!mSender.isSending()) {
destroyApp(true);
notifyDestroyed();
}
} else if (c == mRedCommand) {
String dest = mNumberEntry.getString();
if (dest.length() > 0)
mSender.sendMsg(dest, mPort, "red");
} else if (c == mBlueCommand) {
String dest = mNumberEntry.getString();
if (dest.length() > 0)
mSender.sendMsg(dest, mPort, "blue");
}
}
Search WWH ::




Custom Search