Java me 检查j2me中的CustomItem是否支持遍历
检查j2me中的CustomItem是否支持遍历Java me 检查j2me中的CustomItem是否支持遍历,java-me,midp,lcdui,Java Me,Midp,Lcdui,检查j2me中的CustomItem是否支持遍历 boolean isCustomItemSupported; try { Class.forName("javax.microedition.lcdui.CustomItem"); isCustomItemSupported = true; } catch (Exception e) { isCustomItemSupported = false; } 我应该如何检查j2me中的CustomItem是否支持遍历?Shi
boolean isCustomItemSupported;
try {
Class.forName("javax.microedition.lcdui.CustomItem");
isCustomItemSupported = true;
} catch (Exception e) {
isCustomItemSupported = false;
}
我应该如何检查j2me中的CustomItem是否支持遍历?Shiva,我认为您对遍历的理解存在一些差距。让我解释一下
boolean isCustomItemSupported;
try {
Class.forName("javax.microedition.lcdui.CustomItem");
isCustomItemSupported = true;
} catch (Exception e) {
isCustomItemSupported = false;
}
您可以向表单中添加任意数量的项。该框架为MIDP中内置的所有项管理以下内容
希望这能澄清你的疑问。我强烈建议您看看这个特别的例子,以获得更具体的说明。我找到了解决方案。这对我有用 调用类“javax.microedition.lcdui.CustomItem”的方法“getInteractionModes()”的设备支持查找CustomItem遍历的正确解决方案 下面给出了代码片段
int supported_interaction_modes=this.getInteractionModes();
boolean horizontal__interaction,vertical_interaction;
if((supported_interaction_modes&CustomItem.TRAVERSE_HORIZONTAL)!=0) //Horizontal traverse support
horizontal_interaction=true;
else
horizontal_interaction=false;
if((supported_interaction_modes&CustomItem.TRAVERSE_VERTICAL)!=0)
vertical_interaction=true;
else
vertical_interaction=false;
在上面的代码片段中,“this”指的是从“javax.microedition.lcdui.CustomItem”派生的类的对象。Hi oxigen,感谢您的回复。我还想检查CustomItem中的树版本是否允许。如何做?这不是问题的答案。这只是检查电话上是否有CustomItem。这最多只能告诉应用程序平台是否为MIDP2.0!谢谢你提供的信息。但是你的回答不清楚,不简单。我不明白,这让我很困惑。请尽可能简单,尽可能清楚,尽可能理解格式。让我尽量简单。CustomItem将嵌入表单中。但绘制和事件处理不是通过表单完成的,而是CustomItem。请考虑该窗体包含TeXFieldand Cu饰项目。用户将使用向上键和向下键选择文本字段或表单。除非CustomItem告诉表单它已经完成了它的工作,否则表单将不知道将关键事件移动到TextField。所以,当您在traverse方法中返回false时,表单将知道CustomItem已经完成了它的工作,并将焦点移到TextField。