[求助]关于Choice类的区分
在Panel类里创建了多个Choice类:
choice1 = new Choice();
choice2 = new Choice();
加载Choice类:
this.add(choice1, new XYConstraints(startX, 10, 10, 20));
this.add(choice2, new XYConstraints(startX, 10, 50, 20));
在action函数里接受动作
public boolean action(Event ev, Object obj) {
if (ev.target instanceof Choice) {
if (choice1.getSelectedIndex() > 0) {
//操作
}
if (choice2.getSelectedIndex() > 0){
//操作
}
}
}
请问如何编写才能在action函数里区分当前鼠标点击的是哪个Choice,以使得另一个Choice不进行操作。
谢了。