Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4984669

Underlining in HTML paints incorrectly

XMLWordPrintable

    • beta
    • generic
    • generic



      Name: pzR10082 Date: 01/28/2004


      Run sample code below. The third 'b' is only partially underlined,
      or not underlined at all.

      //------- BEGIN SOURCE CODE -------
      import javax.swing.*;
      import javax.swing.text.*;

      public class Test extends JFrame
      {
          JEditorPane pane = new JEditorPane();

          public Test() throws Exception {
              this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

              this.getContentPane().add(new JScrollPane(pane));
              pane.setEditorKit(new StyledEditorKit());
              pane.getDocument().insertString(0,"12 \n",null);

              MutableAttributeSet attrs = new SimpleAttributeSet();
              StyleConstants.setBold(attrs, true);
              StyleConstants.setItalic(attrs, true);
              StyleConstants.setUnderline(attrs, true);
              StyleConstants.setFontFamily(attrs, "Arial");
              StyleConstants.setFontSize(attrs, 64);
              pane.getDocument().insertString(4, "aa\n", attrs);
              pane.getDocument().insertString(7, "bbb\n", attrs);
              pane.getDocument().insertString(11, "cccc\n", attrs);
              pane.getDocument().insertString(16, "ddddd\n", attrs);
          }

          public static void main(String args[]) throws Exception {
              Test gI = new Test();
              gI.setSize(300, 300);
              gI.setLocationRelativeTo(null);
              gI.setVisible(true);
          }
      }
      //------- END SOURCE CODE -------

      ======================================================================

            peterz Peter Zhelezniakov
            peterz Peter Zhelezniakov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: