-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.0
-
x86
-
windows_nt
Name: el35337 Date: 05/28/98
1. Steps to reproduce the problem
1. run the attached code.
2. in the text area, keep typing f.
3. gradually you can see the caret position moved
forward incorrectly.
4. I tried the following fonts:
dialog, SansSerif, Helvetica, TimesRoman,
Courier, Monospaced, dialogInput, Serif
5. for fonts "dialog","SansSerif","Serif",
"Helvetica", it seems the caret works fine,
but the horizontal scrollbar does not work
properly, it shows up too eariler.
Also you can run the SwingSetApplet in the demo
directory. In the plain text tab, there is a
JTextArea in JScrollPane, if you keep typing in
the same line, you will find the scrollbar does not
work properly.
2. codes
import java.awt.swing.*;
import java.awt.event.*;
import java.awt.*;
public class TextAreaBug
{
public static void main(String[] args)
{
JFrame frame = new JFrame("JTextArea bug");
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
JTextArea textArea = new JTextArea(10,10);
textArea.setFont(new Font("Monospaced",Font.PLAIN,12));
JScrollPane scrollPane=new JScrollPane(textArea);
frame.getContentPane().add("Center", scrollPane);
frame.setSize(200, 200);
frame.setVisible(true);
}
}
(Review ID: 32218)
======================================================================
- duplicates
-
JDK-4136857 JTextArea.getPreferredSize() only works with Monospaced Font
-
- Resolved
-