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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 1.1.7, 1.1.8
    • Fix Version/s: 1.2.2
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      1.2.2
    • CPU:
      generic, sparc
    • OS:
      generic, solaris_2.6

      Description

      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



        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: