#author("2018-04-13T13:06:20+09:00","default:zzr12000","zzr12000")
* [[iアプリ]] [#tc30610f]
いままで、Zaurusしか使ってなかったが、ひょんなことからFOMAを持つことになったので、ちょっとiアプリってどんなものなのか見ていきたいと思います。
#contents

** 環境 [#l504030f]
http://www.nttdocomo.co.jp/p_s/imode/java/より、DoJa4.0プロファイル向けiアプリ開発ツールをダウンロードしました。ついでにアプリコンテンツ開発ガイドもおとしておきましょう。えっ?ava2 SDK, Standard Edition Version 1.3.1?Eclipse 2.1.2? いきなりやる気をそがれるバージョンですな。こりゃ。では、開発環境としてのEclipseをhttp://www.eclipse.org/downloads/index.phpからダウンロードしました。おかけで、私の環境はJDK1.3,JDK1.4 JDK5,Eclipse2,Eclipse3,Eclipse3.1が混在することになりました... ともっていたら、3.1.1で動くじゃないですか!
 Eclipse 2.1.3
 2.1.2_Translations
Eclipseの環境ができましたら、http://www.nttdocomo.co.jp/p_s/imode/java/よりおとした、emufordoja4_0_205_p.zipを解凍して、setup.exeを実行しましょう。セットアップタイプはカスタムを選択します。Sun ONE Studio 4は使わないので、チェックははずして進めます。終わりましたら、Eclipseを立ち上げてウィンドウ>設定より、Dojaがあるか確認しておきましょう。

** サンプル [#w119abbb]
Eclipseのファイル>新規プロジェクトからDoJaプロジェクトを選びます。名前はdojasample1にしました。プロジェクトができたら、ファイル>新規>その他でクラスを選択して、
 package test;
 import com.nttdocomo.ui.*;
 public class Test1 extends IApplication {
   public void start() {
     Display.setCurrent(new HelloPanel());
   }
   class HelloPanel extends Panel {
     public HelloPanel() {
       add(new Label("Hello World"));
     }
   }
 }
セーブして、次にプロジェクト>DoJa-4.0設定>ADF/トラステッド動作設定で
 AppName TEST1
 PackageURL dojasmple1.jar
 AppClass test.Test1
では実行します。実行>実行>DoJa-4.0アプリケーションを選択して、実行です。エミュレータのウィンドウが表示されていればOKです。さてbinを見てみると
 dojasample1.jam
 Download.html
ができいると思います。これをサーバ上において終わりです。サンプルは
[[http://hidekazu.dhs1.sst.ne.jp/iapp/test1.JPG>http://hidekazu.dhs1.sst.ne.jp/iapp/Download.html]]~
表示されるのはHello Worldだけです。QRコードは[[QRWindow>http://www.qrcode.org/]]で作成してます。

** サンプル2 [#p16ae385]
Panel,TextBox,Label,Buttonなど。
 package test;
 import com.nttdocomo.ui.*;
 public class Test1 extends IApplication {
   public void start() {
     testPanel.setSoftLabel(TestPanel.SOFT_KEY_1,"終了");
     Display.setCurrent(testPanel);
   }
 }

 package test;
 import com.nttdocomo.ui.*;
 public class TestPanel extends Panel implements ComponentListener,SoftKeyListener  {
   IApplication mainIApplication;
   Label lblLabel;
   Label lblLabel2;
   TextBox txtBox;
   Button btnButton;
   //コンストラクタ
   TestPanel (IApplication mainIApplication) {
     this.mainIApplication = mainIApplication;
     //ラベル
    lblLabel = new Label("ラベル1",Label.LEFT);
    lblLabel2 = new Label("hohoho",Label.LEFT);
    //テキストボックス デフォルト値、幅、行数、入力制限 
    txtBox = new TextBox("1", 3, 1, TextBox.DISPLAY_ANY);
    //ボタン
    btnButton = new Button("ボタン");
    //コンポーネントの貼り付け
    this.add(lblLabel);
    this.add(txtBox);
    this.add(btnButton);
    this.add(lblLabel2);
    setComponentListener(this); 
    setSoftKeyListener(this);
  }
  public void componentAction(Component component, int type, int param){
    if((component == btnButton) && (type == BUTTON_PRESSED)){
      lblLabel2.setText("ボタンPRESS");
    }
  }
  //ソフトキーのリスナー
  public void softKeyReleased(int param){
    // ソフトキー1が離された時に実行
    if(param == TestPanel.SOFT_KEY_1){
      // iアプリ終了
      mainIApplication.terminate();
    }
  }
  public void softKeyPressed(int param){
  }
 }

** リンク [#e8c5ab56]
http://www.itmedia.co.jp/enterprise/articles/0407/15/news027.html~
http://www.atmarkit.co.jp/fmobile/rensai/doja01/doja01.html~
http://www.geocities.jp/java_iappli/~
http://www.okisoft.co.jp/esc/i-appli.html~
HTTPで通信するサンプルがあります。
** 参考書籍 [#bf166193]

** コメント [#v1fee775]
-#comment


トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS