[java] textarea echo chars

Started by
4 comments, last by cone3d 22 years, 8 months ago
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
---cone3dhttp://cone3d.gamedev.netMy software never has any bugs - it just generates random features
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?
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.

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
---cone3dhttp://cone3d.gamedev.netMy software never has any bugs - it just generates random features
Sun''s JDK 1.3.1 full API documentation.
Ummm....

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

This topic is closed to new replies.

Advertisement