📄 chatmain.java
字号:
import javax.bluetooth.BluetoothStateException;
import javax.bluetooth.LocalDevice;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class ChatMain extends MIDlet {
protected void startApp() throws MIDletStateChangeException {
MainUI ui = new MainUI(this);
DeviceConnection protocol = new DeviceConnection(ui);
try { //获得设备用户名
protocol.setUserName(LocalDevice.getLocalDevice().getFriendlyName());
} catch (BluetoothStateException e) {
protocol.setUserName("用户");
}
new Server(protocol).start(); //开启服务器线程
new Discovery(protocol).start(); //开启设备搜索线程
ui.setCurrent();
}
protected void pauseApp() {
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
Log.clear();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -