HTML text in JEditorPane does not antialias correctly

XMLWordPrintable



      Name: vi73552 Date: 05/04/99


      When displaying HTML text using a JEditorPane and turning on the antialias (and antialias text,
      to be sure) rendering hint, the text does not appear antialiased. Various graphics in the HTML,
      such as underlining, do appear antialiased, but the text itself does not.

      Here's the code:

      import javax.swing.*;
      import java.awt.*;

      public class AntiAliasTest extends JFrame {

      public static void main(String[] args) {
      JFrame frame = new AntiAliasTest();
      frame.setSize(400, 400);
      frame.show();
      }

      public AntiAliasTest() {
      getContentPane().setLayout(new BorderLayout());
      getContentPane().add
      (new TextPanel
      ("<html><body>This is a test<br><u>This is a test</u><br><font size=\"+3\">This is a test<br><u>This is a test</u><br><font></body></html>"),
      BorderLayout.CENTER);
      }


      public class TextPanel extends JEditorPane {
      public TextPanel
      (String text) {
      setContentType("text/html");
      setText(text);
      }

      public void paint(Graphics g) {
      Graphics2D g2d = (Graphics2D)g;
      g2d.setRenderingHint
      (RenderingHints.KEY_ANTIALIASING,
      RenderingHints.VALUE_ANTIALIAS_ON);
      g2d.setRenderingHint
      (RenderingHints.KEY_TEXT_ANTIALIASING,
      RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
      super.paint(g2d);
      }
      }
      }

      Here's the version info:
      C:\users\jclover\work\checkout\shell\classes>java -version
      java version "1.2"
      Classic VM (build JDK-1.2-V, native threads)

      C:\users\jclover\work\checkout\shell\classes>java -fullversion
      JAVA.EXE full version "JDK-1.2-V"
      (Review ID: 57812)
      ======================================================================

            Assignee:
            Andrey Pikalev
            Reporter:
            Vassili Igouchkine (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: