• Advertisement

Archived

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

[java] textarea echo chars

This topic is 6046 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
Why would you want to clear it?

Why can''t you just create a new text field and copy the string to it and then swap them?

Share this post


Link to post
Share on other sites
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
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
Ummm....

First off stick to a jdk for development... then attempt to deplot on a website. Debuggin in a browser just sucks.

Share this post


Link to post
Share on other sites

  • Advertisement