ファーストiアプリケーション(リスト)

【国内記事】 2001年1月25日更新

リスト1 MyFirstiApp.java

// ファーストiアプリ

import com.nttdocomo.ui.*;
import com.nttdocomo.io.*;

public class MyFirstiApp extends IApplication implements KeyListener, ComponentListener {

  public void start() {

    Panel mypanel = new Panel();

    // メッセージ
    mypanel.add(new Label("初めてのiアプリ") );
    mypanel.add(new Label("何かのキーかボタンを押すと終わります") );

    // ボタンを作る
    mypanel.add(new Button("終わり") );

    // リスナを登録する
    mypanel.setKeyListener(this);
    mypanel.setComponentListener(this);

    Display.setCurrent(mypanel);
  }

  // 何かのキーが押された
  public void keyPressed(Panel p, int key) {
  }

  // 何かのキーが放された
  public void keyReleased(Panel p, int key) {
    this.terminate();
  }

  // ボタンが押された
  public void componentAction(Component src, int type, int param) {
    this.terminate();
  }
}

−−−−−−
本文へ戻る



モバイルショップ

最新スペック搭載ゲームパソコン
高性能でゲームが快適なのは
ドスパラゲームパソコンガレリア!

最新CPU搭載パソコンはドスパラで!!
第3世代インテルCoreプロセッサー搭載PC ドスパラはスピード出荷でお届けします!!

FEED BACK