|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
Objectiappli.lib.ui.CComponent
iappli.lib.ui.CCheckList
public final class CCheckList
Canvas上に描画するラジオボタンもしくはチェックボックスです。
本版では、画面サイズを考慮しておりません。
そのため、レイアウトを考慮してご利用ください。
【例】 class Test extends CostumePanel { String list[] = {"AAA", "あいう", "123", "ABC"}; CCheckList ck = new CCheckList( CCheckList.CHECKBOX, list, Graphics.getColorOfName(Graphics.BLACK), Graphics.getColorOfRGB(200, 200, 200, 200), Graphics.getColorOfName(Graphics.WHITE)); public void paint(Graphics g) { ck.show(g, 3, 3, 3, 8, true); addEvent(ck); : } public void processEvent2(CComponent c, int t, int p) { if (c == ck && t == CostumePanel.SELECTION_CHANGED) { int x[] = ((CCheckList)c).getCheckIndex(); for (int i = 0; i < x.length; i++) { System.out.println("SELECT:"+x[i]); } } } }
フィールドの概要 | |
---|---|
static int |
CHECKBOX
チェックボックスを表します(=2)。 |
static int |
RADIO_BUTTON
ラジオボタンを表します(=1)。 |
コンストラクタの概要 | |
---|---|
CCheckList(int type)
チェックボックスを生成します。 |
|
CCheckList(int type,
String[] list)
リストを指定してチェックボックスを生成します。 |
|
CCheckList(int type,
String[] list,
int c1,
int c2,
int s)
リスト、前景色、背景色、影付き色を指定してチェックボックスを生成します。 |
メソッドの概要 | |
---|---|
void |
check()
リストのフォーカスされた位置のチェックボックスにチェックを付けます。 |
void |
check(int num)
リストの特定の位置のチェックボックスにチェックを付けます。 |
int[] |
getCheckIndex()
チェックされている項目の番号を配列で返します。 |
int |
getLength()
リストの項目数を返します。 |
int |
getSelectedIndex()
選択(フォーカス)されている項目の位置を返します。 |
void |
select(int index)
リストの特定の位置の項目を選択します。 |
void |
setList(String[] list)
チェックボックスのリストを設定します。 |
void |
show(Graphics g,
int x,
int y,
int rows,
int w,
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 |
フィールドの詳細 |
---|
public static final int RADIO_BUTTON
public static final int CHECKBOX
コンストラクタの詳細 |
---|
public CCheckList(int type)
type
- リストのタイプを指定します。public CCheckList(int type, String[] list)
type
- リストのタイプを指定します。list
- リストを指定します。public CCheckList(int type, String[] list, int c1, int c2, int s)
type
- リストのタイプを指定します。list
- リストを指定します。c1
- 前景色を指定します。c2
- 背景色を指定します。s
- 影付き色を指定します。メソッドの詳細 |
---|
public void setList(String[] list)
list
- チェックボックスのリストを指定します。public int[] getCheckIndex()
public int getSelectedIndex()
public int getLength()
public void select(int index)
index
- 選択する項目の位置を指定します。 0 〜public void show(Graphics g, int x, int y, int rows, int w, boolean b)
getCheckIndex()
で、
項目番号を取得できます。項目番号は、生成時のリストの配列に対応します。(x, y) ↓ ○ ああああ ◎ いいいい ○ うううう ○ 12345678 ○ おおおお |←w(8)→| |←−−−− rows(3) −−−−→|
g
- キャンパスのグラフィックスオブジェクト(getGraphics())を指定します。x
- 横座標(文字数)を指定します。y
- 縦座標(文字数)を指定します。rows
- 横に表示するチェックボックスの個数を指定します。w
- 横幅(文字数)を指定します。b
- trueを指定すると描画前をバックアップします。
(ヒープメモリが取られるため使わない場合は false を指定してください。)public void check()
public void check(int num)
num
- チェックを付けるリストの配列番号を指定します。
|
Copyright ITmarks Inc. All rights reserved. | |||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |