Java Reference
In-Depth Information
When you enter a word into Jargoneer , it connects to a server to find the definition. Running
this MIDlet will allow you to appear cool in the company of your hacker friends. When someone
uses an unfamiliar word, like “cruft” or “grok,” you can surreptitiously key the word into your
mobile phone and see a definition in a few seconds.
Jargoneer 's source code is provided in Listing 2-1. If you don't want to type it in, you
can download all of the code examples in this topic from the Downloads page at
http://www.apress.com .
Listing 2-1. Jargoneer's Source Code
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Jargoneer extends MIDlet
implements CommandListener, Runnable {
private Display mDisplay;
private Command mExitCommand, mFindCommand, mCancelCommand;
private TextBox mSubmitBox;
private Form mProgressForm;
private StringItem mProgressString;
public Jargoneer() {
mExitCommand = new Command("Exit", Command.EXIT, 0);
mFindCommand = new Command("Find", Command.SCREEN, 0);
mCancelCommand = new Command("Cancel", Command.CANCEL, 0);
mSubmitBox = new TextBox("Jargoneer", "", 32, 0);
mSubmitBox.addCommand(mExitCommand);
mSubmitBox.addCommand(mFindCommand);
mSubmitBox.setCommandListener(this);
mProgressForm = new Form("Lookup progress");
mProgressString = new StringItem(null, null);
mProgressForm.append(mProgressString);
}
public void startApp() {
mDisplay = Display.getDisplay(this);
mDisplay.setCurrent(mSubmitBox);
}
Search WWH ::




Custom Search