src/macosx/classes/sun/lwawt/LWTextFieldPeer.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -35,21 +35,25 @@
import java.awt.peer.TextFieldPeer;
import javax.swing.*;
import javax.swing.text.JTextComponent;
+/**
+ * Lightweight implementation of {@link TextFieldPeer}. Delegates most of the
+ * work to the {@link JPasswordField}.
+ */
final class LWTextFieldPeer
extends LWTextComponentPeer<TextField, JPasswordField>
implements TextFieldPeer, ActionListener {
LWTextFieldPeer(final TextField target,
final PlatformComponent platformComponent) {
super(target, platformComponent);
}
@Override
- protected JPasswordField createDelegate() {
+ JPasswordField createDelegate() {
return new JPasswordFieldDelegate();
}
@Override
void initializeImpl() {
@@ -105,18 +109,19 @@
* when component lost its focus.
*
* @param e the focus event
*/
@Override
- protected void handleJavaFocusEvent(final FocusEvent e) {
+ void handleJavaFocusEvent(final FocusEvent e) {
if (e.getID() == FocusEvent.FOCUS_LOST) {
// In order to de-select the selection
setCaretPosition(0);
}
super.handleJavaFocusEvent(e);
}
+ @SuppressWarnings("serial")// Safe: outer class is non-serializable.
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() {