Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 466620 - JTextPane has bad height (incorrect preferredSize)
Summary: JTextPane has bad height (incorrect preferredSize)
Status: CLOSED DUPLICATE of bug 452573
Alias: None
Product: Fedora
Classification: Fedora
Component: java-1.6.0-openjdk
Version: 10
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Lillian Angel
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: F10DesktopTarget
TreeView+ depends on / blocked
Reported: 2008-10-11 13:44 UTC by Joel Uckelman
Modified: 2009-01-09 19:09 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2009-01-09 19:09:30 UTC

Attachments (Terms of Use)
a test case which shows the problem (deleted)
2008-10-11 13:44 UTC, Joel Uckelman
no flags Details
test run on Sun's JVM (deleted)
2008-10-11 13:48 UTC, Joel Uckelman
no flags Details
test run on OpenJDK JVM (deleted)
2008-10-11 13:50 UTC, Joel Uckelman
no flags Details

Description Joel Uckelman 2008-10-11 13:44:00 UTC
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):


How reproducible:


Steps to Reproduce:
1. javac
2. java Test
Actual results:

There is extra space below the text.

Expected results:

The dialog should be tight around the bottom of the text.

Additional info:

Note that this is a regression from Sun's Java.

Comment 1 Joel Uckelman 2008-10-11 13:48:26 UTC
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.

Comment 2 Joel Uckelman 2008-10-11 13:50:29 UTC
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.

Comment 3 Joel Uckelman 2008-10-11 15:39:55 UTC
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).

Comment 4 Bug Zapper 2008-11-26 03:47:04 UTC
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:

Comment 5 Joel Uckelman 2008-11-29 14:52:14 UTC
This problem still exists in java-1.6.0-openjdk- from Fedora 10.

Comment 6 Omair Majid 2009-01-09 19:09:30 UTC
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 ***

Note You need to log in before you can comment on or make changes to this bug.