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

📄 editform.java

📁 J2ME 浏览文件功能
💻 JAVA
字号:
import javax.microedition.lcdui.*;
import java.io.IOException;

public class EditForm extends Form implements CommandListener{
	ClientMIDlet midlet;
	Command cmdOK = new Command("发送",Command.OK,1);
	Command cmdFile = new Command("选择文件",Command.OK,2);
	Command cmdExit = new Command("退出",Command.EXIT,3);
	TextField txtAddr = new TextField("收信人", "13027974967", 20, TextField.NUMERIC); 
	TextField txtContent = new TextField("内容", "测试内容测试内容测试内容", 200, TextField.ANY); 
	StringItem siPath = new StringItem("文件路径", "file:///root1/Readme"); 

  public EditForm(ClientMIDlet m) {
    super("短信编辑");
	midlet = m;
	this.append(txtAddr);
	this.append(txtContent);
	txtContent.setPreferredSize(this.getWidth(), this.getHeight()-txtAddr.getPreferredHeight()-siPath.getPreferredHeight()-20);
	this.append(siPath);
    addCommand(cmdOK);
	addCommand(cmdExit);
	addCommand(cmdFile);
    setCommandListener(this);
  }

  public void commandAction(Command cmd,Displayable dis){
	if(cmd.equals(cmdFile)){
		midlet.fb.showDir();
		midlet.display.setCurrent(midlet.fb);
	}else if(cmd.equals(cmdOK)){
		if(txtAddr.getString().length()==0){
			Alert alert = new Alert("错误", "您还没有输入收件人号码!", null, AlertType.ERROR);
            alert.setTimeout(2000);
            midlet.display.setCurrent(alert, this);
		} else {
			//准备发送
		}
	}else if(cmd.equals(cmdExit)){
		midlet.destroyApp(true);
	}
  }

  public void setPath(){
	
  }
}

⌨️ 快捷键说明

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