国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

一個(gè)簡單的CustomItem使用案例

2019-11-18 16:06:08
字體:
供稿:網(wǎng)友
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class SimpleItemMIDlet extends MIDlet
    implements CommandListener {
  public void startApp() {
    Form form new Form("SimpleItemMIDlet");
    form.append(new SimpleItem("SimpleItem"));

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

    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();
  }
}

 class SimpleItem extends CustomItem {
  public SimpleItem(String title) { super(title); }
  // CustomItem abstract methods.
  public int getMinContentWidth() { return 100; }
  public int getMinContentHeight() { return 60; }
  public int getPRefContentWidth(int width) {
    return getMinContentWidth();
  }
  public int getPrefContentHeight(int height) {
    return getMinContentHeight();
  }
  public void paint(Graphics g, int w, int h) {
    g.drawRect(0, 0, w - 1, h - 1);
    g.setColor(0x000000ff);
    int offset = 0;
    for (int y = 4; y < h; y += 12) {
      offset = (offset + 12) % 24;
      for (int x = 4; x < w; x += 24) {
        g.fillTriangle(x + offset,     y,
                       x + offset - 3, y + 6,
                       x + offset + 3, y + 6);
      }
    }
  }
}

(出處:http://www.survivalescaperooms.com)



發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 梁平县| 景宁| 丘北县| 商都县| 紫阳县| 汾西县| 临湘市| 大名县| 静海县| 黑龙江省| 习水县| 台北县| 龙江县| 潞城市| 神池县| 喜德县| 南丹县| 沅陵县| 托里县| 南安市| 乐东| 岳阳市| 汉源县| 枣强县| 巫山县| 蓬安县| 车险| 鸡东县| 福州市| 长汀县| 淮滨县| 浮梁县| 深水埗区| 西贡区| 澄江县| 高清| 莱西市| 甘肃省| 金秀| 米脂县| 邹城市|