日期:2014-05-20 浏览次数:20699 次
package test; import com.sun.lwuit.Button; import com.sun.lwuit.Command; import com.sun.lwuit.CommandList; import com.sun.lwuit.Component; import com.sun.lwuit.Container; import com.sun.lwuit.Display; import com.sun.lwuit.Form; import com.sun.lwuit.Image; import com.sun.lwuit.Label; import com.sun.lwuit.ProgressBar; import com.sun.lwuit.TextArea; import com.sun.lwuit.events.ActionEvent; import com.sun.lwuit.events.ActionListener; import com.sun.lwuit.layouts.BoxLayout; import com.sun.lwuit.layouts.GridLayout; import com.yooye.uu.DefaultProgress; import java.io.IOException; import javax.microedition.midlet.*; /** * @author Administrator */ public class TestMidlet extends MIDlet implements ActionListener { private Form f; public void startApp() { Display.init(this); f = new Form("Test Form"); //为Form添加菜单======== Command cc = new Command("测试菜单1"); f.addCommand(cc); f.addCommand(new Command("测试菜单2")); f.addCommandListener(this); //为Form添加菜单结束===== Container con = new Container(new BoxLayout(BoxLayout.Y_AXIS)); f.addComponent(con); Container con1 = new Container(new BoxLayout(BoxLayout.X_AXIS)); con.addComponent(con1); con1.addComponent(new Label("姓名:")); con1.addComponent(new Label("Ckenny.Liu")); con1.addComponent(new Button("修改")); Container con2 = new Container(new BoxLayout(BoxLayout.X_AXIS)); con.addComponent(con2); con2.addComponent(new Label("生日:")); con2.addComponent(new Label("1985-04-15")); con2.addComponent(new Button("修改")); Container con7 = new Container(new BoxLayout(BoxLayout.X_AXIS)); con.addComponent(con7); con7.addComponent(new Label("电话:")); con7.addComponent(new Label("13751878888")); con7.addComponent(new Button("修改")); f.setScrollableY(true); f.show(); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void actionPerformed(ActionEvent evt) { Object o = evt.getSource(); if (o instanceof Command) { //菜单事件处理 } } }