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

📄 datefield.txt

📁 J2ME里面的DateField简单运用 实现简单日历开发
💻 TXT
字号:

import javax.microedition.midlet.*; 
import javax.microedition.lcdui.*; 
 
public class SimpleCalendar extends MIDlet implements CommandListener, ItemStateListener { 
    private Form mainForm; 
    private DateField nameDateField; 
    public SimpleCalendar() { 
        mainForm = new Form("简单日历"); 
        nameDateField = new DateField("日期", DateField.DATE_TIME); 
    } 
    protected void startApp() throws MIDletStateChangeException { 
        mainForm.append(nameDateField); 
        mainForm.addCommand( new Command("退出", Command.EXIT, 1)); 
        mainForm.setItemStateListener(this); 
        mainForm.setCommandListener(this); 
        Display.getDisplay(this).setCurrent(mainForm); 
    } 

    protected void pauseApp() { 
    } 

    protected void destroyApp(boolean _boolean) throws 
            MIDletStateChangeException { 
    } 

    public void commandAction(Command command, Displayable displayable) { 
        if(command.getCommandType() == Command.EXIT) { 
            try { 
               destroyApp(false); 
            } catch (MIDletStateChangeException e) { 
                e.printStackTrace(); 
            } 
            notifyDestroyed(); 
        } 
    } 

    public void itemStateChanged(Item item) { 
    } 
} 
	
	

⌨️ 快捷键说明

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