Red Hat Bugzilla – Bug 466620
JTextPane has bad height (incorrect preferredSize)
Last modified: 2009-01-09 14:09:30 EST
Created attachment 320094 [details]
a test case which shows the problem
Description of problem:
Fix the width of a JTextPane, set it to have whatever height it prefers given that width, and put it into a JDialog which is then packed. Using OpenJDK, the JTextPane ends up with a lot of extra empty space below the text. This works properly with Sun Java 1.6.0_07-b06. I've attached a minimal example program which exhibits the problem.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. javac Test.java
2. java Test
There is extra space below the text.
The dialog should be tight around the bottom of the text.
Note that this is a regression from Sun's Java.
Created attachment 320095 [details]
test run on Sun's JVM
This image is from running the test case in Sun's JVM. The JTextPane appears to have the correct size.
Created attachment 320096 [details]
test run on OpenJDK JVM
This image is from running the test case in the OpenJDK JVM. The JTextPane has a large empty area at the bottom.
The amount of blank space at the bottom of the JTextPane seems to depend on the size of the font used. E.g., add this line to the test case before setting the width of the JTextPane:
The result is that the font size is doubled and the height of the blank space is roughly tripled (from 30px to about 85px).
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.
More information and reason for this action is here:
This problem still exists in java-1.6.0-openjdk-220.127.116.11-6.b12.fc10.x86_64 from Fedora 10.
This is caused by a bug in the calculation of the window size. Fixed upstream:
*** This bug has been marked as a duplicate of bug 452573 ***