下面是一个通过设置DataProvider影响界面的例子,用按钮控制一个当选框的值。
XML界面
<screen>
<_title>%DYNAMIC_DISPLAY%</_title>
<container style="layout:inlinelayout(false,fill);align:center">
<text style="padding: 0 0 15 0">%PLATFORM_NAME(@{platformName})%</text>
<container style="layout:gridlayout(2,1)">
<button onAction="btn_female" shortcuts="1">%FEMALE_BTN%</button>
<button onAction="btn_male" shortcuts="2">%MALE_BTN%</button>
</container>
<text>%GENDER(@{gender})%</text>
<radioGroup onChange="">
<_value>@{gender}</_value>
<radioButton value="F" enabled="true">female</radioButton>
<radioButton value="M" enabled="true">male</radioButton>
</radioGroup>
</container>
<screenFirstMenu onAction="back">返u22238 </screenFirstMenu>
<screenSecondMenu>
%MORE%
<menuPopup>
<menuItem onAction="about">
%ABOUT%
</menuItem>
<menuItem onAction="exitConfirm">
%EXIT%
</menuItem>
</menuPopup>
</screenSecondMenu>
</screen>
事件处理:
public boolean onMessage(Object identifier, Object[] arg1) {
if ("back".equals(identifier)) {
// remove the current frame from the framehandler stack
Kuix.getFrameHandler().removeFrame(this);
// and display the main screen
Kuix.getFrameHandler().getTopFrame().onAdded();
// do not propagate the message through the rest of the frame stack
return false;
} else if ("btn_female".equals(identifier)) {
// use the data provider to set its value
dataProvider.setGender("F");
} else if ("btn_male".equals(identifier)) {
// use the data provider to set its value
dataProvider.setGender("M");
}
// let the next frames in the stack, process the message
return true;
}
运行结果:
分享到:
相关推荐
《kuix-1.1.0源代码解析与应用指南》 在软件开发过程中,遇到导入jar包却找不到类的问题是常有的困扰。为了解决这类问题,我们常常需要深入到源代码层面进行分析和理解。本文将详细介绍kuix-1.1.0的源代码,帮助...
【手机界面kuix-1.1.0】是一款专为移动设备设计的用户界面库,其核心是基于XML和CSS技术构建的。这个库的主要目标是简化开发者在创建应用程序时的UI开发工作,提供了一系列丰富的预定义组件,使得开发者能够快速、...
目前广泛应用的J2Me框架,Kuix是一个使用XML/CSS来开发的lib,它提供了大部分UI组件,比 如:button,textfields,lists,menus,tabs等)。它的主页是源代码放在google code上,http://code.google.com/kuix,如果要使用...
5. **文档支持**:随框架提供的`kuix-1.1.0-doc`文件包含了详细的API文档,有助于开发者快速理解和使用Kuix。 6. **示例应用**:`kuixdemo`文件可能是包含Kuix框架的一些演示程序,通过这些示例,开发者可以直观地...
kuix-1.1.0.zip可能是kuix的更新版本,版本号1.1.0表示这是较早版本的一个升级,可能包含了新功能、性能优化或者错误修复。这种版本命名遵循了软件开发中的常见做法,即主版本号.次要版本号.修订版本号。".zip"格式...
5800上运行较为流畅,全面支持鼠标,但是鼠标操作反应较慢,点击缺少动态的显示,响应慢并且僵硬,可能和它用非标准菜单有关,键盘操作流畅,控件很丰富。wm6上面运行流畅,鼠标也是稍慢,进入文本控件后自动弹出...
- **教程**:从0到5,逐步引导开发者入门,涵盖了基本操作、界面设计、用户行为处理、国际化、动态数据展示以及自定义组件等方面。 2. **社区贡献**:Kalmeo社区鼓励开发者注册并分享他们的KUIX经验,促进项目的...