jdk/src/share/classes/javax/swing/JPasswordField.java
Print this page
@@ -23,17 +23,16 @@
* questions.
*/
package javax.swing;
import javax.swing.text.*;
-import javax.swing.plaf.*;
import javax.accessibility.*;
+import java.beans.JavaBean;
+import java.beans.BeanProperty;
import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
import java.io.IOException;
-import java.io.*;
import java.util.Arrays;
/**
* <code>JPasswordField</code> is a lightweight component that allows
* the editing of a single line of text where the view indicates
@@ -66,17 +65,15 @@
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
- * @beaninfo
- * attribute: isContainer false
- * description: Allows the editing of a line of text but doesn't show the characters.
- *
* @author Timothy Prinzing
* @since 1.2
*/
+@JavaBean(description = "Allows the editing of a line of text but doesn't show the characters.")
+@SwingContainer(false)
@SuppressWarnings("serial") // Same-version serialization only
public class JPasswordField extends JTextField {
/**
* Constructs a new <code>JPasswordField</code>,
@@ -149,10 +146,11 @@
*
* @return the string "PasswordFieldUI"
* @see JComponent#getUIClassID
* @see UIDefaults#getUI
*/
+ @BeanProperty(bound = false)
public String getUIClassID() {
return uiClassID;
}
@@ -189,14 +187,13 @@
* the behavior of a standard <code>JTextField</code>.
*
* @param c the echo character to display
* @see #echoCharIsSet
* @see #getEchoChar
- * @beaninfo
- * description: character to display in place of the real characters
- * attribute: visualUpdate true
*/
+ @BeanProperty(bound = false, visualUpdate = true, description
+ = "character to display in place of the real characters")
public void setEchoChar(char c) {
echoChar = c;
echoCharSet = true;
repaint();
revalidate();
@@ -290,10 +287,11 @@
* security, it is recommended that the returned character array be
* cleared after use by setting each character to zero.
*
* @return the text
*/
+ @BeanProperty(bound = false)
public char[] getPassword() {
Document doc = getDocument();
Segment txt = new Segment();
try {
doc.getText(0, doc.getLength(), txt); // use the non-String API
@@ -381,10 +379,11 @@
*
* @return an <code>AccessibleJPasswordField</code> that serves as the
* <code>AccessibleContext</code> of this
* <code>JPasswordField</code>
*/
+ @BeanProperty(bound = false)
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJPasswordField();
}
return accessibleContext;