Java Reference
In-Depth Information
display.setCurrent (list);
}
}
public void pauseApp() {
}
public void destroyApp (boolean unconditional) {
disconnect();
}
}
Listing 6.5 PdapChat.java—A PDAP Chat Client Using the HTTP Protocol to
Communicate with the Server
import java.io.*;
import java.awt.*;
import java.util.*;
import java.awt.event.*;
import javax.microedition.io.*;
import javax.microedition.midlet.*;
public class PdapChat extends MIDlet implements ActionListener,
Runnable {
Frame frame = new Frame ("PdapChat");
java.awt.List list = new java.awt.List();
TextField text = new TextField();
Button configButton = new Button ("Config");
Button submitButton = new Button ("Submit");
int count = -1;
Timer timer;
String host = "http://localhost:8080";
String nick = "guest";
class ConfigDialog extends Dialog implements ActionListener {
TextField hostField = new TextField (host);
TextField nickField = new TextField (nick);
Button connectButton = new Button ("Connect");
Button abortButton = new Button ("Abort");
ConfigDialog() {
super (frame, "Configuration", true);
Panel labels = new Panel (new GridLayout (0, 1));
Panel fields = new Panel (new GridLayout (0, 1));
Panel buttons = new Panel();
add("West", labels);
add("Center", fields);
add("South", buttons);
labels.add(new Label ("host:"));
labels.add(new Label ("nick:"));
fields.add(hostField);
fields.add(nickField);
connectButton.addActionListener(this);
 
Search WWH ::




Custom Search