KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > oc4j > util > OC4JPasswordInputPanel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.oc4j.util;
21
22 /**
23  *
24  * @author Michal Mocnak
25  */

26 public class OC4JPasswordInputPanel extends javax.swing.JPanel JavaDoc {
27     
28     private String JavaDoc user;
29     
30     /** Creates new form NewJPanel */
31     public OC4JPasswordInputPanel(String JavaDoc user) {
32         this.user = user;
33         
34         initComponents();
35         jPasswordField1.setText("");
36         jPasswordField1.requestFocus();
37         
38         javax.swing.KeyStroke JavaDoc enter = javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ENTER, 0);
39         javax.swing.text.Keymap JavaDoc map = jPasswordField1.getKeymap();
40         
41         map.removeKeyStrokeBinding(enter);
42     }
43     /**
44      * Get the text which the user typed into the input line.
45      * @return the text entered by the user
46      */

47     public String JavaDoc getPassword() {
48         return String.valueOf(jPasswordField1.getPassword());
49     }
50     /** This method is called from within the constructor to
51      * initialize the form.
52      * WARNING: Do NOT modify this code. The content of this method is
53      * always regenerated by the Form Editor.
54      */

55     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
56
private void initComponents() {
57         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
58
59         jTextArea1 = new javax.swing.JTextArea JavaDoc();
60         jLabel1 = new javax.swing.JLabel JavaDoc();
61         jPasswordField1 = new javax.swing.JPasswordField JavaDoc();
62         jLabel2 = new javax.swing.JLabel JavaDoc();
63
64         jTextArea1.setBackground(new java.awt.Color JavaDoc(192, 192, 192));
65         jTextArea1.setEditable(false);
66         jTextArea1.setLineWrap(true);
67         jTextArea1.setText(org.openide.util.NbBundle.getMessage(OC4JPasswordInputPanel.class, "LBL_PasswordLongtext", new Object JavaDoc[] {user})); // NOI18N
68
jTextArea1.setWrapStyleWord(true);
69         jTextArea1.setFocusable(false);
70         jTextArea1.setOpaque(false);
71
72         jLabel1.setLabelFor(jPasswordField1);
73         java.util.ResourceBundle JavaDoc bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/oc4j/util/Bundle"); // NOI18N
74
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, bundle.getString("LBL_PasswordText")); // NOI18N
75

76         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
77         this.setLayout(layout);
78         layout.setHorizontalGroup(
79             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
80             .add(layout.createSequentialGroup()
81                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
82                     .add(jLabel2)
83                     .add(layout.createSequentialGroup()
84                         .addContainerGap()
85                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
86                             .add(org.jdesktop.layout.GroupLayout.LEADING, jTextArea1)
87                             .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
88                                 .add(jLabel1)
89                                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
90                                 .add(jPasswordField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 207, Short.MAX_VALUE)))))
91                 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
92         );
93         layout.setVerticalGroup(
94             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
95             .add(layout.createSequentialGroup()
96                 .add(jLabel2)
97                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
98                 .add(jTextArea1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
99                 .add(14, 14, 14)
100                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
101                     .add(jLabel1)
102                     .add(jPasswordField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
103                 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
104         );
105
106         jTextArea1.getAccessibleContext().setAccessibleDescription(null);
107         jLabel1.getAccessibleContext().setAccessibleDescription(null);
108         jPasswordField1.getAccessibleContext().setAccessibleName("password");
109     }// </editor-fold>//GEN-END:initComponents
110

111     
112     // Variables declaration - do not modify//GEN-BEGIN:variables
113
public javax.swing.JLabel JavaDoc jLabel1;
114     public javax.swing.JLabel JavaDoc jLabel2;
115     public javax.swing.JPasswordField JavaDoc jPasswordField1;
116     public javax.swing.JTextArea JavaDoc jTextArea1;
117     // End of variables declaration//GEN-END:variables
118

119 }
120
Popular Tags