J2ME中文教程 3 MIDP高级UI 的使用[36]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

        addCommand(CMD_OK);

        addCommand(CMD_CANCEL);

        setCommandListener(this);

    }

 

    public void commandAction(Command c, Displayable d) {

        if (c == CMD_OK) {

            // update the table's cell and return

            parent.setText(getString());

            display.setCurrentItem(parent);

        } else if (c == CMD_CANCEL) {

            // return without updating the table's cell

            display.setCurrentItem(parent);

        }

    }

   

}

3.8    TextFieldDateField

TextField和我们前面讲的TextBox大同小异,只是它是作为Form的一个子类存在,而TextBox则是和Form平起平坐,因此我们直接给出代码方便大家的学习。

 

import javax.microedition.lcdui.*;

import javax.microedition.midlet.*;

public class TextFieldWithItemStateListenerMIDlet extends MIDlet

implements ItemStateListener

{

        private Display display;

        public TextFieldWithItemStateListenerMIDlet()

        {

本文关键:J2ME中文教程 3 MIDP高级UI 的使用
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top