Unordered pool lists look Pixelated in JEditorPane

I am using an unordered HTML list to display some text in JEditorPane. The HTML sample looks like this:

<ul><li>Cautious</li>
<li>Curious</li>
</ul>

This works well and well, but, oddly enough, the bullets created <li>do not look equally high quality as the text next to it. (Running Mac OS 10.7.5, if that matters). Circular bullets look block and pixel:

Normal scale:

enter image description here

Reduced:

enter image description here

As is especially noticeable when it is enlarged, it is just a block of pixels that are not symmetrical and do not have any form of smoothing, which makes a less convincing circular marker point. Compared to the text next to it, it looks “off” for the perceptive eye, even with normal scaling.

, ?

EDIT: • (option + 8 Mac) , . , , , <ul><li>, HTML, .

+5
2

, KEY_ANTIALIASING.

globally, KEY_ANTIALIASING, paint() JEditorPane.

public class HTMLTest {    

      public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            String html = "<ul><li>Cautious</li><li>Curious</li></ul>";
            JEditorPane pane = new JEditorPane("text/html", html) {

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

            };
            pane.setVisible(true);

            JOptionPane.showMessageDialog(null, pane);
          }
        });    
      }
}
+4

. , CSS , .

JEditorPane pane = new JEditorPane();
String u = "C:/path/to/bullet.png";
HTMLEditorKit htmlEditorKit = (HTMLEditorKit) pane.getEditorKit();
StyleSheet styleSheet = htmlEditorKit.getStyleSheet();
styleSheet.addRule(String.format("ul{list-style-image:url(%s);margin:0px 20px;", u));
+2

All Articles