01: package com.xoetrope.awt;
02:
03: import net.xoetrope.awt.XButton;
04: import net.xoetrope.awt.XDialog;
05: import net.xoetrope.awt.XEdit;
06: import net.xoetrope.deprecated.xui.helper.BuddyHelper;
07: import net.xoetrope.xui.style.XStyleFactory;
08:
09: /**
10: * A dialog with an input for a password string
11: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
12: * the GNU Public License (GPL), please see license.txt for more details. If
13: * you make commercial use of this software you must purchase a commercial
14: * license from Xoetrope.</p>
15: * <p>$Revision: 1.7 $</p>
16: */
17: public class XPasswordDlg extends XDialog {
18: XEdit passwordField;
19: XButton okBtn, cancelBtn;
20:
21: public XPasswordDlg() {
22: super (true, 2);
23:
24: setSize(340, 90);
25: setCaption("Password Input");
26:
27: okBtn = (XButton) pageHelper.componentFactory.addComponent(
28: "Button", 120, 60, 100, 20, "Ok", "XButton");
29: cancelBtn = (XButton) pageHelper.componentFactory.addComponent(
30: "Button", 230, 60, 100, 20, "Cancel", "XButton");
31:
32: BuddyHelper buddy = new BuddyHelper(
33: (XStyleFactory) pageHelper.componentFactory);
34: passwordField = (XEdit) buddy.addComponent("Edit", 10, 100, 20,
35: 290, 20, "Password", "1010", null);
36: passwordField.setEchoChar('*');
37:
38: getEventHandler().addHandler(this , cancelBtn, "ActionHandler",
39: "closeDlg");
40: getEventHandler().addHandler(this , okBtn, "ActionHandler",
41: "okClicked");
42:
43: setUseNativeHeaders(true);
44: }
45:
46: /**
47: * Close the dialog when the OK button is clicked
48: */
49: public void okClicked() {
50: super .closeDlg();
51: }
52:
53: /**
54: * Close the dialog when the Cancel button is clicked and clear the password field
55: */
56: public void closeDlg() {
57: passwordField.setText("");
58: super .closeDlg();
59: }
60:
61: /**
62: * Get the passord text
63: * @return the password
64: */
65: public String getPassword() {
66: return passwordField.getText();
67: }
68: }
|