2009年5月7日木曜日

AWT Choiceによるポップアップボタンのイベント

■コンストラクタ
new Choice();
■項目の編集
Choice.add(String);
Choice.insert(String,int値);
Choice.remove(String);
Choise.remove(int値);
Choice.removeAll();
String:項目のテキスト
int値:項目のインデックス番号
■イベント
項目選択時のイベント
ItemEvent:ItemListenerを組み込んで処理する
■項目利用のメソッド
String 変数 = Choice.getItem(int値);
引数指定したインデックス番号の項目テキストを得る
int 変数 = Choice.getItemCount();
項目数を得る
int 変数 = Choice.getSelectedIndex();
現在選択されている項目のインデックス番号を得る
String 変数 = Choice.getSelectedItem();
現在選択されている項目テキストを得る

0 件のコメント:

コメントを投稿