简体   繁体   English

J2me中的画布上的文本框

[英]Textbox on canvas in j2me

I am going to make application on j2me using canvas. 我将使用画布在j2me上进行应用。 I want to take textbox or textfield on my canvas. 我想在画布上使用文本框或文本框。

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 这将使您的数据输入更加健壮,并使您免于实现各种键盘问题的痛苦

These items are only available for adding to Form s . 这些项目仅可用于添加到Form Canvas is a class for handling lower-level events. Canvas是用于处理较低级别事件的类。

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. 基本的文本框是一个矩形( drawRect ),其中包含文本( drawString )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM