?? mainlist.java
字號:
import java.io.IOException;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.List;
//主界面
public class MainList extends List implements CommandListener
{
private Image[] imgs = new Image[2];
private Command exit;
private Command choose;
public MainList(String title, int type)
{
super(title, type);
try
{
imgs[0] = Image.createImage("/qq.png");
imgs[1] = Image.createImage("/wow.png");
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
this.append("登錄", imgs[0]);
this.append("注冊", imgs[1]);
exit = new Command("退出", Command.EXIT, 1);
choose = new Command("選擇", Command.OK, 1);
this.addCommand(exit);
this.addCommand(choose);
this.setCommandListener(this);
}
public void commandAction(Command c, Displayable d)
{
if (c.equals(exit))
{
MyLoginMIDlet.midlet.notifyDestroyed();
}
else if (c.equals(choose) || c.equals(List.SELECT_COMMAND))
{
switch (this.getSelectedIndex())
{
case 0:
{
MyLoginMIDlet.midlet.showLoginForm();
break;
}
case 1:
{
MyLoginMIDlet.midlet.showRegisterForm();
break;
}
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -