src/java.desktop/unix/classes/sun/awt/X11/XTextFieldPeer.java
author itakiguchi
Sun, 06 Jan 2019 19:28:21 -0800
changeset 53188 6c8ce24d0fbf
parent 49998 9070717a16a1
permissions -rw-r--r--
8211267: StackOverflowError happened by TextField.setFont(...) Reviewed-by: serb, prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
49998
9070717a16a1 8187392: Deprecated methods in the peers can be removed
serb
parents: 47216
diff changeset
     2
 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4371
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4371
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4371
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4371
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4371
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.awt.X11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.peer.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.event.ActionEvent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.awt.event.ActionListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.awt.event.TextEvent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.swing.text.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.swing.event.DocumentListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.swing.event.DocumentEvent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import javax.swing.plaf.ComponentUI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import javax.swing.InputMap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import javax.swing.JPasswordField;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import javax.swing.SwingUtilities;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import javax.swing.TransferHandler;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import java.awt.event.MouseEvent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import java.awt.event.FocusEvent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import java.awt.event.KeyEvent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
import javax.swing.plaf.UIResource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
import javax.swing.UIDefaults;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
import javax.swing.JTextField;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
import javax.swing.JComponent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
import javax.swing.border.Border;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
import com.sun.java.swing.plaf.motif.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
import java.awt.im.InputMethodRequests;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 2
diff changeset
    55
import sun.util.logging.PlatformLogger;
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 2
diff changeset
    56
4371
dc9dcb8b0ae7 6823138: Need to replace ComponentAccessor with AWTAccessor
dcherepanov
parents: 3938
diff changeset
    57
import sun.awt.AWTAccessor;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
20435
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    59
final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
3938
ef327bd847c0 6879044: Eliminate the dependency on logging from the AWT/2D/Swing classes
mchung
parents: 2
diff changeset
    60
    private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XTextField");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
20435
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    62
    private String text;
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    63
    private final XAWTTextField xtext;
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    64
    private final boolean firstChangeSkipped;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
20435
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    66
    XTextFieldPeer(TextField target) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        super(target);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        text = target.getText();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        xtext = new XAWTTextField(text,this, target.getParent());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        xtext.getDocument().addDocumentListener(xtext);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        xtext.setCursor(target.getCursor());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        XToolkit.specialPeerMap.put(xtext,this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        initTextField();
20435
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    75
        setText(target.getText());
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    76
        if (target.echoCharIsSet()) {
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    77
            setEchoChar(target.getEchoChar());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        else setEchoChar((char)0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
20435
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    81
        int start = target.getSelectionStart();
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    82
        int end = target.getSelectionEnd();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        // Fix for 5100200
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        // Restoring Motif behaviour
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 31656
diff changeset
    85
        // Since the end position of the selected text can be greater than the length of the text,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        // so we should set caret to max position of the text
20435
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    87
        setCaretPosition(Math.min(end, text.length()));
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    88
        if (end > start) {
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    89
            // Should be called after setText() and setCaretPosition()
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    90
            select(start, end);
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    91
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
20435
543c1c7dd21a 7150100: [macosx] "0123456789" is selected in the TextField
serb
parents: 18178
diff changeset
    93
        setEditable(target.isEditable());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        // After this line we should not change the component's text
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        firstChangeSkipped = true;
31656
786638581dba 8085895: The Textfield can't be shown after clicking "Show Textfield" button.
ssadetsky
parents: 30469
diff changeset
    97
        AWTAccessor.getComponentAccessor().setPeer(xtext, this);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   100
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    public void dispose() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        XToolkit.specialPeerMap.remove(xtext);
12285
37f0c586ba99 7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents: 11979
diff changeset
   103
        // visible caret has a timer thread which must be stopped
37f0c586ba99 7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents: 11979
diff changeset
   104
        xtext.getCaret().setVisible(false);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        super.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    void initTextField() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        setVisible(target.isVisible());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        setBounds(x, y, width, height, SET_BOUNDS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
4371
dc9dcb8b0ae7 6823138: Need to replace ComponentAccessor with AWTAccessor
dcherepanov
parents: 3938
diff changeset
   113
        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
dc9dcb8b0ae7 6823138: Need to replace ComponentAccessor with AWTAccessor
dcherepanov
parents: 3938
diff changeset
   114
        foreground = compAccessor.getForeground(target);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        if (foreground == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            foreground = SystemColor.textText;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        setForeground(foreground);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
4371
dc9dcb8b0ae7 6823138: Need to replace ComponentAccessor with AWTAccessor
dcherepanov
parents: 3938
diff changeset
   120
        background = compAccessor.getBackground(target);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        if (background == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
            if (((TextField)target).isEditable()) background = SystemColor.text;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
            else background = SystemColor.control;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        setBackground(background);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        if (!target.isBackgroundSet()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            // This is a way to set the background color of the TextArea
4371
dc9dcb8b0ae7 6823138: Need to replace ComponentAccessor with AWTAccessor
dcherepanov
parents: 3938
diff changeset
   129
            // without calling setBackground - go through accessor
dc9dcb8b0ae7 6823138: Need to replace ComponentAccessor with AWTAccessor
dcherepanov
parents: 3938
diff changeset
   130
            compAccessor.setBackground(target, background);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        if (!target.isForegroundSet()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            target.setForeground(SystemColor.textText);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        setFont(font);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * @see java.awt.peer.TextComponentPeer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     */
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   142
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    public void setEditable(boolean editable) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        if (xtext != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            xtext.setEditable(editable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            xtext.repaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * @see java.awt.peer.ComponentPeer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     */
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   153
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    public void setEnabled(boolean enabled) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        super.setEnabled(enabled);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        if (xtext != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            xtext.setEnabled(enabled);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            xtext.repaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * @see java.awt.peer.TextComponentPeer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     */
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   165
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    public InputMethodRequests getInputMethodRequests() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        if (xtext != null) return xtext.getInputMethodRequests();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        else  return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   172
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    void handleJavaInputMethodEvent(InputMethodEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        if (xtext != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            xtext.processInputMethodEventImpl(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * @see java.awt.peer.TextFieldPeer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     */
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   181
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    public void setEchoChar(char c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        if (xtext != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            xtext.setEchoChar(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            xtext.putClientProperty("JPasswordField.cutCopyAllowed",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                    xtext.echoCharIsSet() ? Boolean.FALSE : Boolean.TRUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * @see java.awt.peer.TextComponentPeer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     */
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   193
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    public int getSelectionStart() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        return xtext.getSelectionStart();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * @see java.awt.peer.TextComponentPeer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     */
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   201
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    public int getSelectionEnd() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        return xtext.getSelectionEnd();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * @see java.awt.peer.TextComponentPeer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     */
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   209
    @Override
28231
b608ffcaed74 8066621: Suppress deprecation warnings in java.desktop module
darcy
parents: 25859
diff changeset
   210
    @SuppressWarnings("deprecation")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    public String getText() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        return xtext.getText();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * @see java.awt.peer.TextComponentPeer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     */
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   218
    @Override
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   219
    public void setText(String text) {
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   220
        setXAWTTextField(text);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        repaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   224
    private void setXAWTTextField(String txt) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        text = txt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        if (xtext != null)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            // JTextField.setText() posts two different events (remove & insert).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            // Since we make no differences between text events,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            // the document listener has to be disabled while
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
            // JTextField.setText() is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
            xtext.getDocument().removeDocumentListener(xtext);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            xtext.setText(txt);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            if (firstChangeSkipped) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                postEvent(new TextEvent(target, TextEvent.TEXT_VALUE_CHANGED));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
            xtext.getDocument().addDocumentListener(xtext);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            xtext.setCaretPosition(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * to be implemented.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @see java.awt.peer.TextComponentPeer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     */
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   245
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    public void setCaretPosition(int position) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        if (xtext != null) xtext.setCaretPosition(position);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    void repaintText() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        xtext.repaintNow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   254
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    public void setBackground(Color c) {
18178
ee71c923891d 8016747: Replace deprecated PlatformLogger isLoggable(int) with isLoggable(Level)
chegar
parents: 16839
diff changeset
   256
        if (log.isLoggable(PlatformLogger.Level.FINE)) {
16839
d0f2e97b7359 8010297: Missing isLoggable() checks in logging code
anthony
parents: 13604
diff changeset
   257
            log.fine("target="+ target + ", old=" + background + ", new=" + c);
d0f2e97b7359 8010297: Missing isLoggable() checks in logging code
anthony
parents: 13604
diff changeset
   258
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        background = c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        if (xtext != null) {
31656
786638581dba 8085895: The Textfield can't be shown after clicking "Show Textfield" button.
ssadetsky
parents: 30469
diff changeset
   261
            if (xtext.getBackground() != c) {
786638581dba 8085895: The Textfield can't be shown after clicking "Show Textfield" button.
ssadetsky
parents: 30469
diff changeset
   262
                xtext.setBackground(c);
786638581dba 8085895: The Textfield can't be shown after clicking "Show Textfield" button.
ssadetsky
parents: 30469
diff changeset
   263
            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
            xtext.setSelectedTextColor(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        repaintText();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   269
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    public void setForeground(Color c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        foreground = c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        if (xtext != null) {
31656
786638581dba 8085895: The Textfield can't be shown after clicking "Show Textfield" button.
ssadetsky
parents: 30469
diff changeset
   273
            if (xtext.getForeground() != c) {
786638581dba 8085895: The Textfield can't be shown after clicking "Show Textfield" button.
ssadetsky
parents: 30469
diff changeset
   274
                xtext.setForeground(foreground);
786638581dba 8085895: The Textfield can't be shown after clicking "Show Textfield" button.
ssadetsky
parents: 30469
diff changeset
   275
            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
            xtext.setSelectionColor(foreground);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            xtext.setCaretColor(foreground);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        repaintText();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   282
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    public void setFont(Font f) {
53188
6c8ce24d0fbf 8211267: StackOverflowError happened by TextField.setFont(...)
itakiguchi
parents: 49998
diff changeset
   284
        boolean isChanged = false;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
        synchronized (getStateLock()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
            font = f;
31656
786638581dba 8085895: The Textfield can't be shown after clicking "Show Textfield" button.
ssadetsky
parents: 30469
diff changeset
   287
            if (xtext != null && xtext.getFont() != f) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                xtext.setFont(font);
53188
6c8ce24d0fbf 8211267: StackOverflowError happened by TextField.setFont(...)
itakiguchi
parents: 49998
diff changeset
   289
                isChanged = true;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        }
53188
6c8ce24d0fbf 8211267: StackOverflowError happened by TextField.setFont(...)
itakiguchi
parents: 49998
diff changeset
   292
        if (isChanged)
6c8ce24d0fbf 8211267: StackOverflowError happened by TextField.setFont(...)
itakiguchi
parents: 49998
diff changeset
   293
            xtext.validate();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    /**
28059
e576535359cc 8067377: My hobby: caning, then then canning, the the can-can
martin
parents: 25859
diff changeset
   297
     * Deselects the highlighted text.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    public void deselect() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        int selStart=xtext.getSelectionStart();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
        int selEnd=xtext.getSelectionEnd();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        if (selStart != selEnd) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
            xtext.select(selStart,selStart);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * to be implemented.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * @see java.awt.peer.TextComponentPeer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     */
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   311
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    public int getCaretPosition() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
        return xtext.getCaretPosition();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * @see java.awt.peer.TextComponentPeer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     */
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   319
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    public void select(int s, int e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        xtext.select(s,e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
        // Fixed 5100806
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        // We must take care that Swing components repainted correctly
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        xtext.repaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   327
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    public Dimension getMinimumSize() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
        return xtext.getMinimumSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   332
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    public Dimension getPreferredSize() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
        return xtext.getPreferredSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   337
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    public Dimension getPreferredSize(int cols) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
        return getMinimumSize(cols);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    private static final int PADDING = 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   344
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    public Dimension getMinimumSize(int cols) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
        Font f = xtext.getFont();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        FontMetrics fm = xtext.getFontMetrics(f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
        return new Dimension(fm.charWidth('0') * cols + 10,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
                             fm.getMaxDescent() + fm.getMaxAscent() + PADDING);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   352
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    public boolean isFocusable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    // NOTE: This method is called by privileged threads.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
    public void action(final long when, final int modifiers) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
                                  text, when,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
                                  modifiers));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    protected void disposeImpl() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   368
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    public void repaint() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        if (xtext  != null) xtext.repaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    }
10096
f9ac9a52952d 6596915: JCK-runtime-6a/tests/api/java_awt/Component/index.html tesPaintAll fails
serb
parents: 5506
diff changeset
   372
    @Override
f9ac9a52952d 6596915: JCK-runtime-6a/tests/api/java_awt/Component/index.html tesPaintAll fails
serb
parents: 5506
diff changeset
   373
    void paintPeer(final Graphics g) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        if (xtext  != null) xtext.paint(g);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   377
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    public void print(Graphics g) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        if (xtext != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
            xtext.print(g);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   384
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    public void focusLost(FocusEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        super.focusLost(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        xtext.forwardFocusLost(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   390
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    public void focusGained(FocusEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        super.focusGained(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        xtext.forwardFocusGained(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   396
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    void handleJavaKeyEvent(KeyEvent e) {
4371
dc9dcb8b0ae7 6823138: Need to replace ComponentAccessor with AWTAccessor
dcherepanov
parents: 3938
diff changeset
   398
        AWTAccessor.getComponentAccessor().processEvent(xtext,e);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   402
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    public void handleJavaMouseEvent( MouseEvent mouseEvent ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
        super.handleJavaMouseEvent(mouseEvent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        if (xtext != null)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
            mouseEvent.setSource(xtext);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
            int id = mouseEvent.getID();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
            if (id == MouseEvent.MOUSE_DRAGGED || id == MouseEvent.MOUSE_MOVED)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
                xtext.processMouseMotionEventImpl(mouseEvent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
                xtext.processMouseEventImpl(mouseEvent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   415
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
    public void setVisible(boolean b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        super.setVisible(b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        if (xtext != null) xtext.setVisible(b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   421
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    public void setBounds(int x, int y, int width, int height, int op) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        super.setBounds(x, y, width, height, op);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        if (xtext != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
             * Fixed 6277332, 6198290:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
             * the coordinates is coming (to peer): relatively to closest HW parent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
             * the coordinates is setting (to textField): relatively to closest ANY parent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
             * the parent of peer is target.getParent()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
             * the parent of textField is the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
             * see 6277332, 6198290 for more information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
            int childX = x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
            int childY = y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
            Component parent = target.getParent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
            // we up to heavyweight parent in order to be sure
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
            // that the coordinates of the text pane is relatively to closest parent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
            while (parent.isLightweight()){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                childX -= parent.getX();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                childY -= parent.getY();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
                parent = parent.getParent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
            xtext.setBounds(childX,childY,width,height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
            xtext.validate();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   448
    final class AWTTextFieldUI extends MotifPasswordFieldUI {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   450
        private JTextField jtf;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   452
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
        protected String getPropertyPrefix() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
            JTextComponent comp = getComponent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
            if (comp instanceof JPasswordField && ((JPasswordField)comp).echoCharIsSet()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
                return "PasswordField";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
                return "TextField";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   462
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
        public void installUI(JComponent c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
            super.installUI(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
            jtf = (JTextField) c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
            JTextField editor = jtf;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
            UIDefaults uidefaults = XToolkit.getUIDefaults();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
            String prefix = getPropertyPrefix();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
            Font f = editor.getFont();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
            if ((f == null) || (f instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
                editor.setFont(uidefaults.getFont(prefix + ".font"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
            Color bg = editor.getBackground();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
            if ((bg == null) || (bg instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
                editor.setBackground(uidefaults.getColor(prefix + ".background"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
            Color fg = editor.getForeground();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
            if ((fg == null) || (fg instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
                editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
            Color color = editor.getCaretColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
            if ((color == null) || (color instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
                editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
            Color s = editor.getSelectionColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
            if ((s == null) || (s instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
                editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
            Color sfg = editor.getSelectedTextColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
            if ((sfg == null) || (sfg instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
                editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
            Color dfg = editor.getDisabledTextColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
            if ((dfg == null) || (dfg instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
                editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
            Border b = editor.getBorder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
            if ((b == null) || (b instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
                editor.setBorder(uidefaults.getBorder(prefix + ".border"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
            Insets margin = editor.getMargin();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
            if (margin == null || margin instanceof UIResource) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
                editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   519
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
        protected void installKeyboardActions() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
            super.installKeyboardActions();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
            JTextComponent comp = getComponent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
            UIDefaults uidefaults = XToolkit.getUIDefaults();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
            String prefix = getPropertyPrefix();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
            InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
            if (map != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
                SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
                                                 map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   537
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
        protected Caret createCaret() {
12523
a3c0565476da 7129742: Unable to view focus in Non-Editable TextArea
zhouyx
parents: 12285
diff changeset
   539
            return new XTextAreaPeer.XAWTCaret();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
23647
41d22f2dbeb5 8033712: Fix more serial lint warnings in sun.awt
darcy
parents: 20469
diff changeset
   543
    @SuppressWarnings("serial") // JDK-implementation class
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   544
    final class XAWTTextField extends JPasswordField
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   545
            implements ActionListener, DocumentListener {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   547
        private boolean isFocused = false;
30469
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   548
        private final XComponentPeer xwin;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
30469
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   550
        XAWTTextField(String text, XComponentPeer xwin, Container parent) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
            super(text);
30469
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   552
            this.xwin = xwin;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
            setDoubleBuffered(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
            setFocusable(false);
4371
dc9dcb8b0ae7 6823138: Need to replace ComponentAccessor with AWTAccessor
dcherepanov
parents: 3938
diff changeset
   555
            AWTAccessor.getComponentAccessor().setParent(this,parent);
30469
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   556
            setBackground(xwin.getPeerBackground());
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   557
            setForeground(xwin.getPeerForeground());
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   558
            setFont(xwin.getPeerFont());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
            setCaretPosition(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
            addActionListener(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
            addNotify();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   564
        @Override
28231
b608ffcaed74 8066621: Suppress deprecation warnings in java.desktop module
darcy
parents: 25859
diff changeset
   565
        @SuppressWarnings("deprecation")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
        public void actionPerformed( ActionEvent actionEvent ) {
30469
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   567
            xwin.postEvent(
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   568
                    new ActionEvent(xwin.target, ActionEvent.ACTION_PERFORMED,
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   569
                                    getText(), actionEvent.getWhen(),
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   570
                                    actionEvent.getModifiers()));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   574
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
        public void insertUpdate(DocumentEvent e) {
30469
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   576
            if (xwin != null) {
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   577
                xwin.postEvent(new TextEvent(xwin.target,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
                                             TextEvent.TEXT_VALUE_CHANGED));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   582
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
        public void removeUpdate(DocumentEvent e) {
30469
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   584
            if (xwin != null) {
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   585
                xwin.postEvent(new TextEvent(xwin.target,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
                                             TextEvent.TEXT_VALUE_CHANGED));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   590
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
        public void changedUpdate(DocumentEvent e) {
30469
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   592
            if (xwin != null) {
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   593
                xwin.postEvent(new TextEvent(xwin.target,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
                                             TextEvent.TEXT_VALUE_CHANGED));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
        public void repaintNow() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
            paintImmediately(getBounds());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   602
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
        public Graphics getGraphics() {
30469
bac0a7ff7e1e 8074028: Remove API references to java.awt.peer
serb
parents: 28236
diff changeset
   604
            return xwin.getGraphics();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   607
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
        public void updateUI() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
            ComponentUI ui = new AWTTextFieldUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
            setUI(ui);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
        void forwardFocusGained( FocusEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
            isFocused = true;
37694
c064aefc5a2f 8080395: consider making sun.awt.CausedFocusEvent functionality public
ssadetsky
parents: 35667
diff changeset
   615
            FocusEvent fe = new FocusEvent(this, e.getID(), e.isTemporary(),
c064aefc5a2f 8080395: consider making sun.awt.CausedFocusEvent functionality public
ssadetsky
parents: 35667
diff changeset
   616
                    e.getOppositeComponent(), e.getCause());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
            super.processFocusEvent(fe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
        void forwardFocusLost( FocusEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
            isFocused = false;
37694
c064aefc5a2f 8080395: consider making sun.awt.CausedFocusEvent functionality public
ssadetsky
parents: 35667
diff changeset
   622
            FocusEvent fe = new FocusEvent(this, e.getID(), e.isTemporary(),
c064aefc5a2f 8080395: consider making sun.awt.CausedFocusEvent functionality public
ssadetsky
parents: 35667
diff changeset
   623
                    e.getOppositeComponent(), e.getCause());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
            super.processFocusEvent(fe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   628
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
        public boolean hasFocus() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
            return isFocused;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
        public void processInputMethodEventImpl(InputMethodEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
            processInputMethodEvent(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
        public void processMouseEventImpl(MouseEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
            processMouseEvent(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
        public void processMouseMotionEventImpl(MouseEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
            processMouseMotionEvent(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
        // Fix for 4915454 - override the default implementation to avoid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
        // loading SystemFlavorMap and associated classes.
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   647
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
        public void setTransferHandler(TransferHandler newHandler) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
            TransferHandler oldHandler = (TransferHandler)
13604
31089af1a447 7163201: Simplify toolkit internals references
bagiras
parents: 12523
diff changeset
   650
                getClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
31089af1a447 7163201: Simplify toolkit internals references
bagiras
parents: 12523
diff changeset
   651
                                      .getJComponent_TRANSFER_HANDLER());
31089af1a447 7163201: Simplify toolkit internals references
bagiras
parents: 12523
diff changeset
   652
            putClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
31089af1a447 7163201: Simplify toolkit internals references
bagiras
parents: 12523
diff changeset
   653
                                  .getJComponent_TRANSFER_HANDLER(),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
                              newHandler);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
            firePropertyChange("transferHandler", oldHandler, newHandler);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
20469
47a792bd7dbf 8025603: Unused methods in the awt text peers should be removed
serb
parents: 20435
diff changeset
   659
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
        public void setEchoChar(char c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
            super.setEchoChar(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
            ((AWTTextFieldUI)ui).installKeyboardActions();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
}