在J2ME中禁用TextField [英] Disable TextField in J2ME
本文介绍了在J2ME中禁用TextField的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在Java ME的运行期间动态禁用和启用TextField
元素?
Is it possible to dynamically make TextField
element disabled and enabled during the run time in Java ME?
推荐答案
according to API documentation, setConstraints(TextField.UNEDITABLE) could do something like that:
设置TextField的输入约束...
Sets the input constraints of the TextField...
请注意,如果您需要保留内容和修饰符标志,则传递给上述方法的参数可能需要进行一些调整,例如
Note if you need to preserve contents and modifier flags, parameter passed to above method might require some tweaking, like
setConstraints((getConstraints() & TextField.CONSTRAINT_MASK)
| TextField.UNEDITABLE) // "disable" - set UNEDITABLE
在上面禁用和重新启用类似的内容:
above to disable, and to enable back, something like:
setConstraints((getConstraints() & TextField.CONSTRAINT_MASK))
// "enable" - cleans up TextField.UNEDITABLE
这篇关于在J2ME中禁用TextField的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文