formlayoutexample.java

来自「大量j2me源代码」· Java 代码 · 共 49 行

JAVA
49
字号

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

public class FormLayoutExample extends MIDlet implements CommandListener
{
   private Form form;

   public FormLayoutExample()
   {
      form = new Form("Layout Example");

      SmileyItem s1 = new SmileyItem("Smile");

      // set the layout to expand this item as much as possible,
      // also indicate we are using MIDP 2 layout styles
      s1.setLayout(Item.LAYOUT_EXPAND | Item.LAYOUT_2);

      form.append(s1);

      SmileyItem s2 = new SmileyItem("Smile");
      form.append(s2);

      form.addCommand(new Command("Exit", Command.EXIT, 0));
      form.setCommandListener(this);
   }

   public void startApp()
   {
      Display.getDisplay(this).setCurrent(form);
   }

   public void pauseApp()
   {
   }

   public void destroyApp(boolean unconditional)
   {
   }

   public void commandAction(Command c, Displayable s)
   {
      if (c.getCommandType() == Command.EXIT)
         notifyDestroyed();
   }

}

⌨️ 快捷键说明

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