e
}
public void getState(AccessibleControlEvent e) {
int state =
int childID = e
if (childID == ACC
state = ACC
}
else if (childID >=
state = ACC
if (isFocusControl()) {
state |= ACC
}
if (rowSel == childID) {
state |= ACC
if (isFocusControl()) {
state |= ACC
}
}
}
e
}
});
最後
if (index >= getItemCount() || index <
return;
oldRowSel = rowSel;
rowSel = index;
selectionChanged();
}
public int getSelectionIndex() {
return rowSel;
}
public int getItemHeight() {
return lineHeight;
}
public void setItemHeight(int height) {
lineHeight = height;
}
public int getItemCount() {
return colors
}
public void add(int colorIndex
colorNames
colors
}
我們開發的控件的使用也是非常簡單的
CustomList customlist = new CustomList( parent
customlist
customlist
customlist
customlist
customlist
以上我們介紹了如何開發一個簡單的自定義控件所需要涉及的技術
[
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28981.html