📄 additem.java
字号:
/*
* Created on 2005-3-24
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package ground;
import java.util.Date;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
/**
* @author seesum
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class AddItem extends MIDlet implements ItemStateListener,
CommandListener
{
private Display display;
private Form fmMain;
private Command cmExit;
private DateField dfDate;
/**
*
*/
public AddItem()
{
display=Display.getDisplay(this);
dfDate=new DateField("Date is:",DateField.DATE);
dfDate.setDate(new Date());
cmExit=new Command("Exit",Command.EXIT,1);
fmMain=new Form("ItemListener J2me");
fmMain.addCommand(cmExit);
fmMain.append(dfDate);
fmMain.setCommandListener(this);
fmMain.setItemStateListener(this);
}
/* (non-Javadoc)
* @see javax.microedition.midlet.MIDlet#startApp()
*/
protected void startApp() throws MIDletStateChangeException
{
display.setCurrent(fmMain);
}
/* (non-Javadoc)
* @see javax.microedition.midlet.MIDlet#pauseApp()
*/
protected void pauseApp()
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.microedition.midlet.MIDlet#destroyApp(boolean)
*/
protected void destroyApp(boolean arg0) throws MIDletStateChangeException
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.microedition.lcdui.ItemStateListener#itemStateChanged(javax.microedition.lcdui.Item)
*/
public void itemStateChanged(Item arg0)
{
dfDate.setLabel("new Date:");
}
/* (non-Javadoc)
* @see javax.microedition.lcdui.CommandListener#commandAction(javax.microedition.lcdui.Command, javax.microedition.lcdui.Displayable)
*/
public void commandAction(Command arg0, Displayable arg1)
{
if(arg0==cmExit)
{
// try
{
Form fmNew=new Form("new");
display.setCurrent(fmNew);
//destroyApp(false);
//notifyDestroyed();
}
/*catch (MIDletStateChangeException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}*/
}
}
public static void main(String[] args)
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -