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 Form
s. 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.