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

Incorrect i18n text document layout.

XMLWordPrintable

    • b96
    • 9
    • b137
    • generic
    • generic

      setting i18n property to true for a document brakes the text layout.

      Compile and run the next test:

      public class I18nTest {
          public static void main(String[] args) throws Exception {
              JFrame jFrame = new JFrame();
              JEditorPane component = new JEditorPane();
              component.setEditorKit(new StyledEditorKit());
              component.getDocument().putProperty("i18n", Boolean.TRUE);
              SimpleAttributeSet attrs = new SimpleAttributeSet();
              StyleConstants.setFontSize(attrs, 72);
              StyleConstants.setBold(attrs, true);
              StyleConstants.setUnderline(attrs, true);
              component.getDocument().insertString(0, "test test", null);
              component.getDocument().insertString(5, "TEST TEST TEST", attrs);
              jFrame.getContentPane().add(new JScrollPane(component));
              jFrame.setSize(300, 500);
              jFrame.setVisible(true);
          }
      }

      it produces layout shown on the l2.png screenshot, but should look like l1.png.

        1. l1.png
          l1.png
          18 kB
        2. l2.png
          l2.png
          20 kB

            prr Philip Race
            ssadetsky Semyon Sadetsky (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: