?? instantchat.java
字號:
/*
* @(#)InstantChat.java 1.6 03/03/02
*
* Copyright (c) 2003 Qualcomm, Inc. All rights reserved.
* PROPRIETARY/CONFIDENTIAL
* Use is subject to license terms
*/
package com.qualcomm.demo.instantchat;
import javax.microedition.midlet.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import java.io.*;
public class InstantChat extends MIDlet implements CommandListener {
private final static String DATAGRAM = "Datagram";
private final static String SOCKET = "Socket";
private static String[] names = {DATAGRAM, SOCKET};
private static Display display;
private Form f;
ChoiceGroup cg;
private boolean isPaused;
private Command exitCommand = new Command("Exit", Command.EXIT, 1);
private Command startCommand = new Command("Start", Command.ITEM, 1);
public InstantChat() {
display = Display.getDisplay(this);
f = new Form("Instant Chat");
cg = new ChoiceGroup("Please select protocol",
Choice.EXCLUSIVE, names, null);
f.append(cg);
f.addCommand(exitCommand);
f.addCommand(startCommand);
f.setCommandListener(this);
display.setCurrent(f);
}
public static Display getDisplay() {
return display;
}
public boolean isPaused() {
return isPaused;
}
public void startApp() {
isPaused = false;
}
public void pauseApp() {
isPaused = true;
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
destroyApp(true);
notifyDestroyed();
} else if (c == startCommand) {
String name = cg.getString(cg.getSelectedIndex());
if (name.equals(DATAGRAM)) {
DatagramClient datagramClient = new DatagramClient(this);
datagramClient.start();
}
else {
SocketClient socketClient = new SocketClient(this);
socketClient.start();
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -