iappli.lib.ui
クラス CButton

Object
  上位を拡張 iappli.lib.ui.CComponent
      上位を拡張 iappli.lib.ui.CButton

public final class CButton
extends CComponent

Canvas上に描画するボタンです。

 【例】
 class Test extends CostumePanel {
   CButton bt = new CButton("ボタン");
 
   public void paint(Graphics g) {

     bt.show(g, 10, 10, true);
     addEvent(bt);
         :
   }
 
   public void processEvent2(CComponent c, int t, int p) {
     if (c == bt &&
         t == Display.KEY_PRESSED_EVENT &&
         p == Display.KEY_SELECT) {
           System.out.println("ボタンが押された");
     }
   }
 }
 


コンストラクタの概要
CButton()
          ボタンを生成します。
CButton(String text)
          ボタンのラベル文字列を指定してボタンを生成します。
CButton(String text, int c, int s)
          ボタンのラベル文字列、前景色、影付き色を指定してボタンを生成します。
 
メソッドの概要
 void setLabel(String text)
          ボタンのラベル文字列を設定します。
 void show(Graphics g, int x, int y, boolean b)
          ボタンを描画します。
 
クラス iappli.lib.ui.CComponent から継承されたメソッド
clear, setBackground, setBackup, setFont, setForeground, setGraphics, setLocation, setShadow, setSize
 
クラス Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

CButton

public CButton()
ボタンを生成します。


CButton

public CButton(String text)
ボタンのラベル文字列を指定してボタンを生成します。

パラメータ:
text - ボタンのラベル文字列を指定します。

CButton

public CButton(String text,
               int c,
               int s)
ボタンのラベル文字列、前景色、影付き色を指定してボタンを生成します。

パラメータ:
text - ラベル文字列を指定します。
c - 前景色を指定します。
s - 影付き色を指定します。
メソッドの詳細

setLabel

public void setLabel(String text)
ボタンのラベル文字列を設定します。

パラメータ:
text - ボタンのラベル文字列を指定します。 null が指定された場合は空文字列("")が設定されます。

show

public void show(Graphics g,
                 int x,
                 int y,
                 boolean b)
ボタンを描画します。
描画中のグラフィックスオブジェクトは、lock、unlock を実行しません。 呼び出し側にて実行してください。

パラメータ:
g - キャンパスのグラフィックスオブジェクト(getGraphics())を指定します。
x - 横座標(文字数)を指定します。
y - 縦座標(文字数)を指定します。
b - trueを指定すると描画前をバックアップします。 (ヒープメモリが取られるため使わない場合は false を指定してください。)

Copyright ITmarks Inc. All rights reserved.