文本字段 - 用户开始输入文本之前显示提示 [英] TextField - show hint before user starts typing text
问题描述
我开发的BlackBerry应用程序。我想显示文本字段中的一个提示文本用户开始typing.when用户开始输入就应该消失前,当有文本字段0字符它应该显示up.Has人实现了这个了吗?那么就请大家分享。
I am developing an Blackberry application. I want to show a hint text in TextField before user starts typing.when user starts typing it should disappear and when there are 0 characters in TextField it should show up.Has anybody implemented this yet?then please share.
推荐答案
这里是涂料中的实现()方法
here is the implementation within paint() method
String test = super.getText();
if ( test == null || test.length() < 1 ) {
graphics.setColor( 0x00a0a0a0 );
graphics.drawText(hint, 0, 0);
}
和这里的源感谢peter_strange
<一href=\"http://supportforums.blackberry.com/t5/Java-Development/Prompt-hint-place-holder-text-on-a-Numeric-Password-edit-field/m-p/990817#M151704\" rel=\"nofollow\">http://supportforums.blackberry.com/t5/Java-Development/Prompt-hint-place-holder-text-on-a-Numeric-Password-edit-field/m-p/990817#M151704
and here is the source thanks to peter_strange http://supportforums.blackberry.com/t5/Java-Development/Prompt-hint-place-holder-text-on-a-Numeric-Password-edit-field/m-p/990817#M151704
这篇关于文本字段 - 用户开始输入文本之前显示提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!