Java Reference
In-Depth Information
Caution The JPasswordField also has a deprecated read-only text property, which you should avoid
using. You should use the password property instead, because it returns a char[] that can be cleared
immediately after usage. A String must wait for the garbage collector to dispose of it.
Customizing a JPasswordField Look and Feel
The JPasswordField is a subclass of a JTextField . It has the same appearance under all the
predefined look and feel types as the JTextField (see Figure 15-15). The one difference is that
the current echoChar property setting masks the content. This is shown in Figure 15-16. The top
text component is a JTextField ; the bottom one is a JPasswordField .
Figure 15-16. JPasswordField sample in Ocean theme
The set of 17 UIResource -related properties for a JPasswordField is shown in Table 15-7.
Table 15-7. JPasswordField UIResource Elements
Property String
Object Type
PasswordField.actionMap
ActionMap
PasswordField.background
Color
PasswordField.border
Border
PasswordField.caretAspectRatio
Number
PasswordField.caretBlinkRate
Integer
PasswordField.caretForeground
Color
PasswordField.disabledBackground
Color
PasswordField.focusInputMap
InputMap
PasswordField.font
Font
PasswordField.foreground
Color
PasswordField.inactiveBackground
Color
PasswordField.inactiveForeground
Color
PasswordField.keyBindings
KeyBinding[ ]
 
Search WWH ::




Custom Search