-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P4
-
None
-
Affects Version/s: 1.2.0
-
Component/s: client-libs
-
Fix Understood
-
generic, x86
-
generic, windows_nt
Name: gsC80088 Date: 12/01/98
The following code fragment just opens a frame with
a JEditorPane in it, but with text anti-aliasing
turned on. On both PC's I ran this on, trying to
edit/highlight text causes a complete mess.
Other related problems I've had with text anti-aliasing
include JInternalFrame title bars drawing over the
end of the title text, and button labels drawing
incorrectly.
It all appears to be related to FontMetrics not
returning the correct width for a line of text.
import java.awt.*;
import javax.swing.*;
public class Test extends JFrame
{
public static void main (String[] args)
{
JFrame f = new Test();
f.setBounds (50, 50, 400, 400);
f.setVisible (true);
}
public Test()
{
JEditorPane ed = new JEditorPane()
{
public void paint (Graphics g)
{
if (g instanceof Graphics2D)
{
((Graphics2D)g).setRenderingHint (RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
((Graphics2D)g).setRenderingHint (RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
}
super.paint (g);
}
};
ed.setBackground (Color.white);
ed.setVisible (true);
ed.setFont (new Font ("SansSerif", Font.BOLD, 15));
setContentPane (ed);
}
}
(Review ID: 43510)
======================================================================
- causes
-
JDK-8148746 JEditorPane: font rendering issues (undrawn text, invalid selection)
-
- Closed
-
- duplicates
-
JDK-4235341 HTML text in JEditorPane does not antialias correctly
-
- Closed
-
- relates to
-
JDK-4836162 Selection and Caret are drawn incorrectly when JTextField is Scaled
-
- Open
-