src/macosx/classes/sun/lwawt/LWTextFieldPeer.java

Print this page

        

*** 32,42 **** import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.peer.TextFieldPeer; ! import javax.swing.JPasswordField; import javax.swing.text.JTextComponent; final class LWTextFieldPeer extends LWTextComponentPeer<TextField, JPasswordField> implements TextFieldPeer, ActionListener { --- 32,42 ---- import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.peer.TextFieldPeer; ! import javax.swing.*; import javax.swing.text.JTextComponent; final class LWTextFieldPeer extends LWTextComponentPeer<TextField, JPasswordField> implements TextFieldPeer, ActionListener {
*** 48,58 **** super(target, platformComponent); } @Override protected JPasswordField createDelegate() { ! return new JTextAreaDelegate(); } @Override public void initialize() { super.initialize(); --- 48,58 ---- super(target, platformComponent); } @Override protected JPasswordField createDelegate() { ! return new JPasswordFieldDelegate(); } @Override public void initialize() { super.initialize();
*** 69,81 **** @Override public void setEchoChar(final char echoChar) { synchronized (getDelegateLock()) { getDelegate().setEchoChar(echoChar); ! getDelegate().putClientProperty("JPasswordField.cutCopyAllowed", ! getDelegate().echoCharIsSet() ! ? Boolean.FALSE : Boolean.TRUE); } } @Override public Dimension getPreferredSize(final int columns) { --- 69,90 ---- @Override public void setEchoChar(final char echoChar) { synchronized (getDelegateLock()) { getDelegate().setEchoChar(echoChar); ! final boolean cutCopyAllowed; ! final String focusInputMapKey; ! if (echoChar != 0) { ! cutCopyAllowed = false; ! focusInputMapKey = "PasswordField.focusInputMap"; ! } else { ! cutCopyAllowed = true; ! focusInputMapKey = "TextField.focusInputMap"; ! } ! getDelegate().putClientProperty("JPasswordField.cutCopyAllowed", cutCopyAllowed); ! InputMap inputMap = (InputMap) UIManager.get(focusInputMapKey); ! SwingUtilities.replaceUIInputMap(getDelegate(), JComponent.WHEN_FOCUSED, inputMap); } } @Override public Dimension getPreferredSize(final int columns) {
*** 111,125 **** setCaretPosition(0); } super.handleJavaFocusEvent(e); } ! private final class JTextAreaDelegate extends JPasswordField { // Empty non private constructor was added because access to this // class shouldn't be emulated by a synthetic accessor method. ! JTextAreaDelegate() { super(); } @Override public boolean hasFocus() { --- 120,134 ---- setCaretPosition(0); } super.handleJavaFocusEvent(e); } ! private final class JPasswordFieldDelegate extends JPasswordField { // Empty non private constructor was added because access to this // class shouldn't be emulated by a synthetic accessor method. ! JPasswordFieldDelegate() { super(); } @Override public boolean hasFocus() {