关于 ComboBox 和 Radio
来源:互联网 发布:无抵押网络借款 编辑:程序博客网 时间:2024/05/16 13:01
最近用到了 ComboBox 和 Radio 在网上找了写例子看了下,但是出不了效果,后来自己研究了一下,终于出效果了,现在记录一下:
ComboBox ;
ListStore<BaseModel> merchantStore = new ListStore<BaseModel>();
merchantStore.add(getType());
ComboBox<BaseModel> merchant = new ComboBox<BaseModel>();
merchant.setFieldLabel("商户:");
merchant.setDisplayField("type");
merchant.setEmptyText("==Select==");
merchant.setStore(merchantStore);
merchant.setTypeAhead(true);
merchant.setTriggerAction(TriggerAction.ALL);
formPanel.add(merchant, new FormData("100%"));
private List<BaseModel> getType() {
List<BaseModel> list = new ArrayList<BaseModel>();
list = new ArrayList<BaseModel>();
BaseModel bm = new BaseModel();
bm.set("type", "猫类");
bm.set("key",1);
list.add(bm);
bm = new BaseModel();
bm.set("type", "狗类");
bm.set("key",2);
list.add(bm);
bm = new BaseModel();
bm.set("type", "鸟类");
bm.set("key",3);
list.add(bm);
bm = new BaseModel();
bm.set("type", "其他");
bm.set("key",4);
list.add(bm);
return list;
}
取值:
types.addListener(Events.Change, new Listener<ComponentEvent>(){
public void handleEvent(ComponentEvent be) {
ComboBox<BaseModel> selectBox = (ComboBox) be.getComponent();
type = selectBox.getValue().get("type");
}
});
Radio :
final RadioGroup group = new RadioGroup();
group.setFieldLabel("宠物性别");
Radio first = new Radio();
first.setData("key", 1);
first.setBoxLabel("雄性");
first.setValue(true);
group.add(first);
Radio second = new Radio();
second.setData("key", 2);
second.setBoxLabel("雌性");
group.add(second);
formPanel.add(group, new FormData("100%"));
取值;
group.addListener(Events.Change, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
RadioGroup selectedRadioGroup = (RadioGroup) ((FieldEvent) be).getComponent();
String haha = selectedRadioGroup.getValue().getData("key")+"";
if(haha.equals("1")){
sex = "雄性";
}
if(haha.equals("2")){
sex = "雌性";
}
}
});
- 关于 ComboBox 和 Radio
- Radio/combobox控件的用法
- 请教:关于Stringgird和combobox的关联
- 关于comboBox和grid的使用问题
- 关于ComboBox
- Selenium+Python Radio,Checkbox,Link,ComboBox控件
- 控件定位学习:radio、checkbox、ComboBox
- 关于checkBox,radio和select标签的一些常见问题总结
- 关于从后台查询取值到前台的radio和checkbox
- 关于 jQuery 获取和设置[select][radio][checkbox]的值
- 关于checkbox、radio和下拉列表取值
- C 关于页面刷新和combobox的使用
- 关于DataGridView,ComboBox,XDocument和XElement的一点总结
- 关于C#DataSet对象和ComboBox数据源清空问题
- 关于comboBox和grid的使用问题(Extjs)
- WTL 关于radio
- 关于ComboBox的用法
- 关于ComboBox的运用
- 自动化工具
- 用正则表达式将空格
- Spring Hessian
- 即时通讯技术动态
- 架设移动开发环境:Qt-wince 平台 (转载)
- 关于 ComboBox 和 Radio
- LoadRunner9录制https脚本相关
- 关于Tencent的面试题
- gdb 调试vector
- 大规模服务如何将机器最优化使用
- 字符编解码的故事(ASCII,ANSI,Unicode,Utf-8)
- Register Script(二)
- days@intel(一)
- TSP开发总结