postarticleui.java

来自「<j2me 开发精解> 詹建光著 里所有的源码。对J2me的开发相当」· Java 代码 · 共 51 行

JAVA
51
字号
/*
 * PostArticleUI.java
 *
 * Created on 2005年11月1日, 下午2:28
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */

package com.j2medev.ch5.post.ui;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import com.j2medev.ch5.post.*;

/**
 *
 * @author Administrator
 */
public class PostArticleUI extends Form implements CommandListener {
    
    private UIController controller = null;
    private TextField title = new TextField("文章标题:", "", 20, TextField.ANY);
    private TextField author = new TextField("作  者:", "", 20, TextField.ANY);
    public static final Command nextCommand = new Command("输入内容",Command.OK,1);
    /** Creates a new instance of PostArticleUI */
    public PostArticleUI(UIController controller) {
        
        super("发表文章");
        this.controller = controller;
        this.append(title);
        this.append(author);
        this.addCommand(nextCommand);
        this.setCommandListener(this);
   
    }
    
    public void commandAction(Command cmd,Displayable displayable){
        if(cmd == nextCommand){
            String a_title = title.getString();
            String a_author = author.getString();
            controller.handleEvent(UIController.EventID.INPUT_CONTENT, new Object[]{a_title,a_author});
        }
    }
    
}

⌨️ 快捷键说明

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