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

[macosx] Issue with getPreferredSize of JTextArea

    XMLWordPrintable

    Details

      Description

      FULL PRODUCT VERSION :
      java version "1.9.0-ea"
      Java(TM) SE Runtime Environment (build 1.9.0-ea-b65)
      Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b65, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      os x version 10.8.5 build 12F45

      A DESCRIPTION OF THE PROBLEM :
      getPreferredSize of JTextArea is wrong.
      the returned width is one pixel more than the current width


      REGRESSION. Last worked in version 8u60

      ADDITIONAL REGRESSION INFORMATION:
      Java(TM) SE Runtime Environment (build 1.8.0_60-ea-b08)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b08, mixed mode)


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The preferred size should be not keep changing.
      ACTUAL -
      The preferred size keeps getting wider by one pixel.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Dimension;

      import javax.swing.JTextArea;
      import javax.swing.SwingUtilities;

      public class JTextAreaPreferredSizeTest
      {
      public static void main(String[] args)
      {
      SwingUtilities.invokeLater(new Runnable()
      {

      @Override
      public void run()
      {
      JTextArea textArea = new JTextArea("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vel mauris eget ante viverra bibendum in ut nulla. Donec varius suscipit arcu, vitae molestie ipsum pharetra eu. Aliquam suscipit sagittis justo. Aliquam erat volutpat. Vivamus dignissim lectus turpis, eget accumsan.");
      textArea.setLineWrap(true);

      for (int index = 0; index < 255; ++index)
      {
      Dimension size = textArea.getPreferredSize();
      textArea.setSize(size);

      System.out.println(size);
      }
      }
      });
      }
      }

      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              alexsch Alexandr Scherbatiy
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: