?? stringitemtest.java
字號:
//StringItemTest.java
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class StringItemTest extends MIDlet
implements CommandListener,ItemStateListener, ItemCommandListener
{
private Display display;
Command commit ;
public StringItemTest ()
{
display = Display.getDisplay(this);
}
public void startApp()
{
commit = new Command("Commit",Command.SCREEN,1) ;
Form f = new Form("Form與StringItem") ;
f.append("String 1") ;
f.append("String 2") ;
StringItem item1 = new StringItem("Label ","大眾日報最新消息",Item.PLAIN);
StringItem item2 = new StringItem("Button ","確定",Item.BUTTON);
StringItem item3 = new StringItem("hyper-link ","點這里查看詳情",Item.HYPERLINK);
Command cmd2 = new Command( "OK", Command.ITEM, 1 );
item2.setDefaultCommand( cmd2 );
item2.setItemCommandListener( this );
Command cmd3 = new Command( "Detail", Command.ITEM, 1 );
item3.setDefaultCommand( cmd3 );
item3.setItemCommandListener( this );
f.append( item1 );
f.append( item2 );
f.append( item3 );
f.addCommand(commit) ;
f.addCommand( cmd2 );
f.addCommand( cmd3 );
f.setCommandListener(this) ;
f.setItemStateListener(this) ;
display.setCurrent(f) ;
}
public void pauseApp()
{ }
public void destroyApp(boolean unconditional)
{ }
public void commandAction(Command c,Displayable s)
{
Form tmp = (Form) s ;
for(int i = 0 ; i < tmp.size() ; i++)
{
StringItem si = (StringItem) tmp.get(i) ;
System.out.println(si.getText());
}
}
public void itemStateChanged(Item item)
{}
public void commandAction(Command c, Item item )
{
System.out.println(item.getLabel());
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -