|
|
Hi im making a small system. I need to created a username and password box to allow a user to view a tab. Im fairly new to jave and im not sure how i would do it.
Could someone help me?
thanks
|
|
|
|
If you wish to provide a graphical login dialog box for your application, you can use the AWT's TextField class, which is a text component that allows the editing of a single line of text. To mask the password field, use the setEchoChar method. For example, to set the echo char to an asterisk, you would do:
TextField password = new TextField(8);
password.setEchoChar('*');
But i would recomment using swing, use the JPassword Field the api link is:
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JPasswordField.html
This is how simple it is to set up:
passwordField = new JPasswordField(10);
passwordField.setActionCommand(OK);
passwordField.addActionListener(this);
This will get you started!
|
|
|
|
|
|
|
|