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

Pre-selected TextField shifts behind left Edge when multibyte is used

XMLWordPrintable

    • x86
    • windows_nt

      Run attached code on Window95/NT Japanese:
      Both JDK1.1.6/1.2Beta4 tested.

      When window appears, starting position of TextField moved to "123", instead of "abc". In other words, string is shifted beyond left edge of TextField.

      This doesn't happen in case removing multi.selectAll() call on the middle of code.

      -----
      import java.io.*;
      import java.awt.*;
      import java.awt.event.*;

      public class TestApp1B extends Frame implements ActionListener {
      TextField multi = new TextField("abcdefg\ufffd\ufffd\ufffd\ufffd\ufffd123\ufffd\ufffd\ufffd", 50);
      Button b = new Button("selectAll()");

      public static void main(String args[]) {
      TestApp1B ta1A = new TestApp1B();
      }

      public TestApp1B() {
      addWindowListener(new WindowAdapter() {
      public void windowClosing( WindowEvent e ) {
      System.exit(0);
      }
      });

      b.addActionListener(this);

      // It's a bug.
      multi.selectAll();

      setTitle("test window");
      setLayout(new FlowLayout(FlowLayout.LEFT));
      setSize(400, 120);
      add(multi);
      add(b);

      setVisible(true);
      }

      public void actionPerformed(ActionEvent e) {
      multi.selectAll();
      }
      }
      -----

      koushi.takahashi@japan 1998-06-16

            osemenovsunw Oleg Semenov (Inactive)
            ktakahassunw Koushi Takahashi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: