Java Reference
In-Depth Information
ConfigForm() {
super ("Configuration");
append (hostField);
append (nickField);
addCommand (connectCommand);
addCommand (abortCommand);
setCommandListener(this);
}
public void commandAction(Command c, Displayable d) {
if (c == connectCommand) {
host = hostField.getString();
nick = nickField.getString();
connect();
}
display.setCurrent (list);
}
}
static String readLine (Reader reader) throws IOException {
StringBuffer buf = new StringBuffer();
while (true) {
int c = reader.read();
if (c == -1) {
if (buf.length() == 0) return null;
break;
}
if (c == 10) break;
if (c != 13) buf.append ((char) c);
}
return buf.toString();
}
public MidpChat() {
list.addCommand (write);
list.setCommandListener(this);
text.addCommand (submit);
text.addCommand (cancel);
text.setCommandListener(this);
}
public void startApp() {
display = Display.getDisplay (this);
if (timer == null)
configure();
else
display.setCurrent (list);
}
void configure() {
disconnect();
display.setCurrent (new ConfigForm());
}
void connect() {
disconnect();
if (transfer (null)) {
timer = new Timer();
timer.schedule (new RefreshTask(), 0, 4000);
}
}
Search WWH ::




Custom Search