Re: setEchoCharacter and some more

Charlie Lai (Charlie.Lai@Eng)
Mon, 27 Oct 1997 16:03:05 -0800 (PST)

From: Charlie.Lai@Eng (Charlie Lai)
Message-Id: <199710280003.QAA02756@angeles.eng.sun.com>
Subject: Re: setEchoCharacter and some more
To: ericsmal@xs4all.nl (Eric Smalley)
Date: Mon, 27 Oct 1997 16:03:05 -0800 (PST)
In-Reply-To: <1.5.4.32.19971027042926.006760d8@xs4all.nl> from "Eric Smalley" at Oct 26, 97 09:29:26 pm

hi,

> I know you should be able to use the setEchoChar(char) function, and I tried
> it as followed (I showed the complete applet, but I pointed out the specific
> trouble section with an arrow( ==>) ):
>
> import java.applet.Applet;
> import java.awt.*;
> import java.awt.event.*;
>
> public class password extends Applet implements ActionListener {
>
> Button button1;
> TextField text1;
> passFrame frame1;
> String string1;
>
> public void init() {
>
> text1 = new TextField(5);

try setting the echo char here like this:
text1.setEchoChar('*');

> add(text1);
> text1.addActionListener(this);
>
> button1 = new Button("Access information");
> add(button1);
> button1.addActionListener(this);
>
> string1 = new String("abcde");
>
> frame1 = new passFrame("Password Frame");
> frame1.resize(150, 100);
> }
>
> public void actionPerformed(ActionEvent e) {
>
> if(e.getSource() == button1) {
> ==> text1.setEchoChar("*");
> if(text1.getText().equals(string1)) {
> frame1.show();
> text1.setText("");
> }
> }
> }
> }

charlie