Topic: 文本框的setEchoChar一直出错

  Print this page

1.文本框的setEchoChar一直出错 Copy to clipboard
Posted by: benkhe
Posted on: 2005-12-27 16:16

import java.applet.*;
import java.awt.*;

public class simplefile extends Applet
{
TextField text1,text2,text3;
public void init()
{
text1=new TextField("请输入密码",10);
text1.setEditable(false);
text2=new TextField(10);
text2.setEchoChar("a");
text3=new TextField(33);
add(text1);add(text2);add(text3);
}
}

错误如下
simplefile.java:12: setEchoChar(char) in java.awt.TextField cannot be applied to
(java.lang.String)
text2.setEchoChar("a");
^
1 error

请指教,谢谢

2.Re:文本框的setEchoChar一直出错 [Re: benkhe] Copy to clipboard
Posted by: benkhe
Posted on: 2005-12-27 19:11

没人啊?

3.Re:文本框的setEchoChar一直出错 [Re: benkhe] Copy to clipboard
Posted by: why
Posted on: 2005-12-27 22:14

The error message is clear enough:
setEchoChar(char) in java.awt.TextField cannot be applied to (java.lang.String)

http://java.sun.com/j2se/1.4.2/docs/api/java/awt/TextField.html#setEchoChar(char)
public void setEchoChar(char c)

i.e. text2.setEchoChar('a');


Don't expect to get response within 3 hours or even a day or two.
Be patient and stop posting meaningless message like the one above!
PLEASE STOP IT!

4.Re:文本框的setEchoChar一直出错 [Re: benkhe] Copy to clipboard
Posted by: benkhe
Posted on: 2005-12-27 22:26

不好意思,初学者,让版主受累了。

5.Re:文本框的setEchoChar一直出错 [Re: benkhe] Copy to clipboard
Posted by: why
Posted on: 2005-12-27 22:35

benkhe wrote:
不好意思,初学者,让版主受累了。

We could only help you once or twice, perhaps only on simple matters like this.
You really have to be familiar with the error messages and basic debugging skills.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923