Textbox on canvas in j2me

荒凉一梦 提交于 2020-01-15 09:23:06

问题


I am going to make application on j2me using canvas. I want to take textbox or textfield on my canvas.


回答1:


You can draw a basic textbox and display a string , and when it receives focus, you can switch the view to that particular textbox ,something like this

textBox = new TextBox(....);
Midlet.display.setCurrent(textBox);

This would create your data entry more robust and save you from the pain of implementing various keyboard issues yourselves




回答2:


These items are only available for adding to Forms. Canvas is a class for handling lower-level events.

You have to implement your own textbox, and that isn't easy.
Basic textbox would be a rectangle (drawRect) with text (drawString) inside of it.



来源:https://stackoverflow.com/questions/3243982/textbox-on-canvas-in-j2me

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