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

Selected text scrolls text out of view even if there is enough room

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.1.8
    • 1.1.6
    • client-libs
    • 1.1.8
    • x86
    • windows_nt
    • Verified



        Name: chT40241 Date: 03/11/98


        Problem: TextField scrolls selected text out of view although the
        TextField is wide enough to display all text. This problem occurs only if the text is selected. In addition, the problem appears to be related to the length of the text with a text length of 13 or greater causing a problem.

        Compile and run this code to see that the text is scrolled such that "fghijklmnop" is displayed and highlighted instead of the whole text string as happens on the Microsoft VM.

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

        public class TestTextField implements WindowListener {
          Frame fr = new Frame("TestTextField");
          public TestTextField() {
              fr.setSize(300,300);
              TextField tf = new TextField("", 35);
              fr.add(tf, "Center");
              String s = "abcdefghijklmnop";
              tf.setText(s);
              //tf.select(0, s.length());
              fr.addWindowListener(this);
              fr.setVisible(true);
          }
          public void windowOpened(WindowEvent e) {}
          public void windowClosing(WindowEvent e) {
              fr.dispose();
          }
          public void windowClosed(WindowEvent e) {
              System.exit(0);
          }
          public void windowIconified(WindowEvent e) {}
          public void windowDeiconified(WindowEvent e) {}
          public void windowActivated(WindowEvent e) {}
          public void windowDeactivated(WindowEvent e) {}
          public static void main(String[] args) {
              new TestTextField();
          }
        }

        ======================================================================

              prssunw Prs Prs (Inactive)
              chickeysunw Chuck Hickey (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: