home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
main.bin
/
vpojava.DLL
/
SOURCE
/
PASSWORD_DIALOG
< prev
next >
Wrap
Text File
|
1998-03-18
|
3KB
|
113 lines
import java.awt.*;
import symantec.itools.awt.util.dialog.ModalDialog;
public class PasswordDialog extends ModalDialog
{
public PasswordDialog(Frame parent, String title)
{
super(parent, title);
// This code is automatically generated by Visual Cafe when you add
// components to the visual environment. It instantiates and initializes
// the components. To modify the code, only use code syntax that matches
// what Visual Cafe can generate, or Visual Cafe may be unable to back
// parse your Java file into its visual environment.
//{{INIT_CONTROLS
setLayout(null);
setSize(215, 130);
nameLabel = new Label("Name:");
nameLabel.setBounds(10, 32, 75, 15);
add(nameLabel);
passwordLabel = new Label("Password:");
passwordLabel.setBounds(10, 60, 75, 15);
add(passwordLabel);
userTextField = new TextField(1);
userTextField.setBounds(85, 28, 100, 22);
add(userTextField);
passTextField = new TextField(1);
passTextField.setEchoCharacter('*');
passTextField.setBounds(85, 57, 100, 22);
add(passTextField);
okButton = new Button("OK");
okButton.setBounds(80, 95, 40, 20);
add(okButton);
//}}
}
public PasswordDialog(Frame parent)
{
this(parent, "Username/Password");
}
// Add a constructor for Interactions (ignoring modal)
public PasswordDialog(Frame parent, boolean modal)
{
this(parent);
}
// Add a constructor for Interactions (ignoring modal)
public PasswordDialog(Frame parent, String title, boolean modal)
{
this(parent, title);
}
public String getUserName()
{
return userTextField.getText();
}
public String getPassword()
{
return passTextField.getText();
}
public void setUserName(String name)
{
userTextField.setText(name);
}
public void setPassword(String pass)
{
passTextField.setText(pass);
}
public void addNotify()
{
// Record the size of the window prior to calling parents addNotify.
Dimension d = getSize();
super.addNotify();
if (fComponentsAdjusted)
return;
// Adjust components according to the insets
setSize(insets().left + insets().right + d.width, insets().top + insets().bottom + d.height);
Component components[] = getComponents();
for (int i = 0; i < components.length; i++)
{
Point p = components[i].getLocation();
p.translate(insets().left, insets().top);
components[i].setLocation(p);
}
fComponentsAdjusted = true;
}
// Used for addNotify check.
boolean fComponentsAdjusted = false;
//{{DECLARE_CONTROLS
java.awt.Label nameLabel;
java.awt.Label passwordLabel;
java.awt.TextField userTextField;
java.awt.TextField passTextField;
java.awt.Button okButton;
//}}
}