⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contentform.java

📁 《Java ME手机应用开发大全》源码 書籍內容簡介: http://www.china-pub.com/410
💻 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)
            {
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -