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

📄 contentform.java

📁 1.test.jsp实现了获得J2ME传来的信息和发送邮件 2.wtk1中实现了邮件的发送 3.activation.jar和mail.jar是发送邮件的包
💻 JAVA
字号:
package com.j2medev.mail;

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 + -