【Java开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了Java开源代码-ContentForm.java的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
import javax.microedition.midlet.MIDlet;
//定义输入邮件内容的屏幕类
public class ContentForm extends TextBox implements CommandListener
{
private MailClient midlet;
//声明是否是第一个窗体的标志位
private boolean first = true;
public static final Command sendCommand = new Command("SEND", Command.ITEM,1);
public ContentForm(String arg0, String arg1, int arg2, int arg3,
MailClient midlet)
{
super(arg0, arg1, arg2, arg3);
this.midlet = midlet;
if (first)
{
first = false;
init();
}
}
//初始化控件并添加到屏幕上
public void init()
{
this.addCommand(sendCommand);
this.setCommandListener(this);
}
public void commandAction(Command cmd, Displayable disp)
{
if (cmd == sendCommand)
{
String content = this.getString();
midlet.getMessage().setContent(content);
System.out.println(midlet.getMessage());
try
{
synchronized (midlet)
{
midlet.notify();
}
} catch (Exception e)
{
}
}
}
}
上一篇:
ContentDAOImpl.java
下一篇:
法律专业开题报告范文