Java Reference
In-Depth Information
public PdapTerminal() {
frame = new Frame ("GcfTerminal");
frame.addWindowListener(new WindowAdapter() {
public void windowClosing (WindowEvent e) {
destroyApp (true);
notifyDestroyed();
}
});
connectButton.addActionListener(this);
Panel topPanel = new Panel (new BorderLayout());
//topPanel.add("West", protocolChoice);
topPanel.add("Center", urlField);
topPanel.add("East", connectButton);
sendButton.addActionListener(this);
Panel bottomPanel = new Panel (new BorderLayout());
bottomPanel.add("Center", sendField);
bottomPanel.add("East", sendButton);
frame.add("North", topPanel);
frame.add("Center", incoming);
frame.add("South", bottomPanel);
frame.pack();
}
/** Shows the given string thread safe by handing a new Appender
to invokeLater */
public void show (String s) {
try {
Toolkit.getDefaultToolkit().getSystemEventQueue()
.invokeAndWait (new Appender (s));
}
catch (Exception e) {
throw new RuntimeException (e.toString());
}
}
/** Shows the main frame on the device screen */
public void startApp() {
frame.show();
}
/** Handles the buttons by opening a connection or sending text
*/
public void actionPerformed (ActionEvent event) {
try {
if (event.getSource() == sendButton && handler != null) {
handler.out.write (sendField.getText().getBytes());
Search WWH ::




Custom Search