Disable TextField in J2ME

主宰稳场 提交于 2019-12-06 21:38:34

according to API documentation, setConstraints(TextField.UNEDITABLE) could do something like that:

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!