setFirstLineIndent cause sizes to be wrong

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P3
    • None
    • Affects Version/s: 6u1
    • Component/s: client-libs

      J2SE Version (please include all output from java -version flag):
      java version "1.6.0_01"
      Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
      Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

      Does this problem occur on J2SE 5.0.x or 6.0? Yes / No (pick one)
      Yes

      Operating System Configuration Information (be specific):
      Microsoft Windows XP [Version 5.1.2600]

      Bug Description:
      setFirstLineIndent causes sizes to be wrong

      When I run the following code I notice two (probably related) problems:
      1) The cursor is twice as high as it should be
      2) The text does not fit in the allocated area

      import static javax.swing.JFrame.*;
      import javax.swing.*;
      import javax.swing.text.*;

      public class Test {
        public static void main(String[] args) {
          try {
            JEditorPane pane = new JEditorPane("text/html", "");
            SimpleAttributeSet attributeSet = new SimpleAttributeSet();
            StyleConstants.setFirstLineIndent(attributeSet, 36);
            pane.getDocument().insertString(0, "Sample Text\nSample Text", attributeSet);
            JPanel panel = new JPanel();
            panel.add(pane);
            JFrame frame = new JFrame();
            frame.add(panel);
            frame.pack();
            frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
            frame.setVisible(true);
          }
          catch (Exception ex) {
            ex.printStackTrace();
          }
        }
      }

            Assignee:
            Peter Zhelezniakov
            Reporter:
            Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: