10 Replies Latest reply: Jan 3, 2013 7:20 AM by Gen.Java RSS

    Bullet problem

    Gen.Java
      Hi all,

      I am displaying a simple HTML list in a JEditorPane(). The list is displayed but the bullets are larger than the browser equivalent and has jagged circle.
      JFrame f;
      JEditorPane ep;
      String s;
      
      s = "<html> <ul> <li>first<li>second </ul> </html>";
      ep=new JEditorPane("text/html",s);
      
      f=new JFrame();
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.getContentPane().add(ep);
      f.pack();
      f.setVisible(true);
      Thank you
        • 1. Re: Bullet problem
          EJP
          Fascinating. Your question?
          • 2. Re: Bullet problem
            Gen.Java
            EJP wrote:
            Fascinating. Your question?
            How can I display an HTML list in a JEditorPane() where the list bullets have the same appearance as the browser equivalent? Currently it is larger and has jagged circle.

            Please run my code. and then display the HTML in a browser to see the difference.

            Edited by: Gen.Java on Jan 1, 2013 1:04 AM
            • 3. Re: Bullet problem
              TPD-Opitz
              Gen.Java wrote:
              How can I display an HTML list in a JEditorPane() where the list bullets have the same appearance as the browser equivalent? Currently it is larger and has jagged circle.
              Did you check that your sample HTML looks all the same in opera, safari, firefox, links and IE ?
              There is no (an cannot be a) global definition how the bullet should be rendered. But you could try using CSS http://www.w3schools.com/css/css_list.asp ?

              bye
              TPD
              • 4. Re: Bullet problem
                Gen.Java
                Thank you TPD. I tried the sample HTML in Safari and found that it looks bigger than in IE. However, they both display smooth circles. JEditorPane displays jagged circles which look bad.
                • 5. Re: Bullet problem
                  gimbal2
                  On which OS is this since you're sticking to the default look & feel? Sounds like an anti aliasing type of problem to me.
                  • 6. Re: Bullet problem
                    Gen.Java
                    gimbal2 wrote:
                    On which OS is this since you're sticking to the default look & feel? Sounds like an anti aliasing type of problem to me.
                    Windows XP and Vista.

                    Yes, I am referring to an anti aliasing problem.

                    I also tried it on all major look & feels and the HTML is the same, so I don't think that changing the L&F will help.
                    • 7. Re: Bullet problem
                      gimbal2
                      Can you reproduce on a different computer?
                      • 8. Re: Bullet problem
                        Gen.Java
                        gimbal2 wrote:
                        Can you reproduce on a different computer?
                        I only have Windows XP and Vista machines. If you have others, can you please try my sample?

                        Thank you
                        • 9. Re: Bullet problem
                          gimbal2
                          Gen.Java wrote:
                          gimbal2 wrote:
                          Can you reproduce on a different computer?
                          I only have Windows XP and Vista machines. If you have others, can you please try my sample?

                          Thank you
                          Very well then, but the next time post an example which actually compiles and runs without needing to be modified.

                          Windows 7 + Java 6 - It looks like crud, but I don't ask much from the Swing HTML renderer as I don't intend it to be a browser, just a way to display styled stuff. It looks like a bullet list, so I'm content with it. Why are you expecting something more?
                          • 10. Re: Bullet problem
                            Gen.Java
                            Thank you gimbal2 for the info and sorry for the trouble.