I have a routine that requests an administrators approval for access to protected data.
for security the adminsirator needs to know what data is requested.
The following routine gets the password without any problem:
public static Boolean Confirm_Change() {
Boolean test = false;
JPasswordField pf = new JPasswordField();
int okCxl = JOptionPane.showConfirmDialog(null,pf, "Administrator -- Enter your Password", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
if (okCxl == JOptionPane.OK_OPTION) {
String password = new String(pf.getPassword());
if (password.equals("admin")) {
test = true;
} else {
test = false;
}
}
return test;
}
What I want is to display above the password box a text field that gives a brief description of the request for access.... such as
| <user-name> is requesting access to: |
| Change Purchase order request routine |
| Please enter your password to approve |
the text portion (line2) will be passed to the routine in the calling statement. Confirm_Change(String text)
How would I go about adding this text field to a showConfirmDialog box or do I need to use another type of JOptionPane?
Thanks