本文整理汇总了Java中com.codename1.ui.events.ActionEvent.getComponent方法的典型用法代码示例。如果您正苦于以下问题:Java ActionEvent.getComponent方法的具体用法?Java ActionEvent.getComponent怎么用?Java ActionEvent.getComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.codename1.ui.events.ActionEvent
的用法示例。
在下文中一共展示了ActionEvent.getComponent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void actionPerformed(ActionEvent evt) {
if(evt.getComponent() instanceof Button) {
lastClickedComponent = (Button)evt.getComponent();
return;
}
if(parentList instanceof List) {
// prevent list from losing focus on action
parentList.setHandlesInput(true);
Object selection = ((List)parentList).getSelectedItem();
if(selection instanceof Map) {
Map h = (Map)selection;
Command cmd = (Command)h.get("$navigation");
if(cmd != null) {
parentList.getComponentForm().dispatchCommand(cmd, new ActionEvent(cmd,ActionEvent.Type.Command));
return;
}
int slen = selectedEntries.length;
for(int iter = 0 ; iter < slen ; iter++) {
if(selectedEntries[iter] instanceof CheckBox ||
selectedEntries[iter] instanceof RadioButton) {
boolean sel = !isSelectedValue(h.get(selectedEntries[iter].getName()));
if(h.get(SELECT_ALL_FLAG) != null) {
selectAllChecked = sel;
selectAllOffset = ((List)parentList).getSelectedIndex();
// we need to toggle all entries
int count = ((List)parentList).getModel().getSize();
String selectionVal = "" + sel;
for(int x = 0 ; x < count ; x++) {
Object o = ((List)parentList).getModel().getItemAt(x);
if(o instanceof Map) {
((Map)o).put(selectedEntries[iter].getName(), selectionVal);
}
}
} else {
if(selectAllChecked) {
selectAllChecked = false;
Map selAll = (Map)((List)parentList).getModel().getItemAt(selectAllOffset);
selAll.put(selectedEntries[iter].getName(), "false");
}
h.put(selectedEntries[iter].getName(), "" + sel);
}
return;
}
}
}
}
}