Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4194422

setText() on TextField with EchoChar is broken for DBCS locales

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.2.2
    • 1.1.7, 1.1.8
    • client-libs
    • 1.2.2
    • generic, sparc
    • generic, solaris_2.6

      For DBCS locales, TextField.setText() does not work properly after TextField.setEchoChar(). The test case below illustrates the problem.

      Type some text in the upper textfield, then press the button. The number of "*" characters in the lower textfield should then match the number of characters entered in the upper textfield.

      import java.applet.*;
      import java.awt.*;
      import java.awt.event.*;

      public class EchoChar extends Applet implements ActionListener {

          TextField enter, display;

          public void init() {
              enter = new TextField(25);
              display = new TextField(25);
              display.setEditable(false);
              display.setEchoChar('*');
              display.setText("abcdefghijklmnopqrstuvwxyz");
              setLayout(new GridLayout(3, 2, 10, 10));
              add(new Label("Enter Text : "));
              add(enter);
              add(new Label("Press button to change echoed text"));
              Button setTextButton = new Button("Set Text");
              add(setTextButton);
              setTextButton.addActionListener(this);
              add(new Label("Echoed text : "));
              add(display);
          }

          public void actionPerformed(ActionEvent e) {
              display.setText(enter.getText());
          }

      }

      This works okay under single byte locales on Solaris 1.1.7, because of the fix for 4084454 but is broken under DBCS locales (eg ja_JP) - it just beeps and doesn't replace the text in the lower TextField.


      stuart.lawrence@eng 1998-12-02



            mbronsonsunw Mike Bronson (Inactive)
            slawson Stuart Lawson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: