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();
}
}
======================================================================