📄 tel.java
字号:
package src;
import java.io.IOException;
import java.io.OutputStream;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
public class Tel implements CommandListener
{
private Form form;
private TextField text;
private Display display;
private Command cancel,ok;
private SendMessage message;
private OutputStream os;
public Tel(Display x,SendMessage y)
{
message = y;
display = x;
form = new Form("地址");
text = new TextField("地址","",20,TextField.NUMERIC);
os = message.getOut();
form.append(text);
ok = new Command("确定",Command.OK,1);
cancel = new Command("返回",Command.CANCEL,1);
form.addCommand(ok);
form.addCommand(cancel);
form.setCommandListener(this);
x.setCurrent(form);
// TODO 自动生成构造函数存根
}
public void commandAction(Command com, Displayable arg1)
{
String lab = com.getLabel();
if(lab.equals("确定"))
{
String temp = text.getString()+'\n';
try
{
os.write(temp.getBytes());
String mes = message.getText();
os.write(mes.getBytes());
}
catch (IOException e)
{
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
if(lab.equals("返回"))
{
message.show();
}
// TODO 自动生成方法存根
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -