01: package com.calipso.reportgenerator.userinterface;
02:
03: import com.calipso.reportgenerator.common.LanguageTraslator;
04:
05: import javax.swing.*;
06: import java.awt.*;
07:
08: /**
09: *
10: * User: jbassino
11: * Date: 10/09/2004
12: * Time: 15:07:25
13: *
14: */
15: public class UserPasswordFrame extends UserLoginFrame {
16:
17: public UserPasswordFrame(Frame owner, String title, boolean modal,
18: String defaultUserName) throws HeadlessException {
19: super (owner, title, modal, defaultUserName);
20: }
21:
22: protected void createComponents() {
23: getContentPane().setLayout(new BorderLayout());
24: getContentPane().add(createNorthPanel(), BorderLayout.CENTER);
25: getContentPane().add(createSouthPanel(), BorderLayout.SOUTH);
26: java.awt.Dimension screenSize = java.awt.Toolkit
27: .getDefaultToolkit().getScreenSize();
28: setLocation((screenSize.width - 250) / 2,
29: (screenSize.height - 200) / 2);
30: setSize(new Dimension(250, 85));
31: setVisible(true);
32: }
33:
34: protected JComponent createNorthPanel() {
35: JPanel pnlNorth = new JPanel(new GridLayout(1, 1));
36: JLabel label = new JLabel("Password");
37: pfUser = new JPasswordField();
38: pnlNorth.add(label);
39: pnlNorth.add(pfUser);
40: return pnlNorth;
41: }
42:
43: public static String getRootPassword() {
44: UserPasswordFrame passwordFrame = new UserPasswordFrame(null,
45: LanguageTraslator.traslate("330"), true, null);
46: if (!passwordFrame.getHasCanceled()) {
47: return passwordFrame.getUserPasswd();
48: } else {
49: return "";
50: }
51: }
52:
53: }
|