Archived

This topic is now archived and is closed to further replies.

cone3d

[java] textarea echo chars

Recommended Posts

cone3d    150
Hi. I''ve got a problem: I wrote a chat applet. Users may log in to the system by writing their name and password into a text field. The only problem is: when I do setEchoChar(''*'') on the textfield before asking the user for a password, I can''t get it back to normal afterwards. I want to do something like clearEchoChar() to remove the echoing. Only such a method doesn''t exist. Can anybody please help me? --- cone3d http://cone3d.gz.ee -> soon http://cone3d.gamedev.net

Share this post


Link to post
Share on other sites
snowmoon    122
Why not read the JavaDoc?

setEchoChar
public void setEchoChar(char c)
Sets the echo character for this text field.
An echo character is useful for text fields where user input should not be echoed to the screen, as in the case of a text field for entering a password. Setting echoChar = 0 allows user input to be echoed to the screen again.

Share this post


Link to post
Share on other sites
cone3d    150
I''m not a very good JAVA programmer. In fact this chat is the first big thingy i''ve ever created with java. I''ve only read one book dealing with java: Teach yourself JAVA in 21 days. And it was about JAVA v1.0. I don''t know any good [ places about / resources on ] java on the net.

Anyway, I tried creating a new text field (even before you suggested it) using this line (inputTextFld is the variable of the textfield)

inputTextFld=new TextField();

but after that line nothing happened. The textfield remained the same. I''m using a gridbag layout. So I even tried updating it. No luck.

Then I tried

inputTextFld.setEchoChar(0);

result:

error: Cannot find method "setEchoChar(int)"

and then I tried this:

inputTextFld.setEchoChar((char) 0);

also no luck. That only made it echo 0-characters. NS kept beeping when I pressed a key, NS 6 echoed some dotted boxes. (NO IE, I''m in linux...)


so I''m pretty much clueless. Any help would be appreciated.


---

cone3d

http://cone3d.gz.ee
-> soon http://cone3d.gamedev.net

Share this post


Link to post
Share on other sites