Bug 661610

Summary: Ok button in JFileChooser is too narrow in GTK LookAndFeel
Product: [Fedora] Fedora Reporter: Joel Uckelman <uckelman>
Component: java-1.6.0-openjdkAssignee: Omair Majid <omajid>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: ahughes, dbhole, jvanek, langel, lkundrak, mjw, mmatejov, omajid
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-26 18:03:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
test program showing the problem
none
screenshot of the problem
none
result with same button sizes
none
patch to make buttons the same size none

Description Joel Uckelman 2010-12-09 08:15:40 UTC
Created attachment 467699 [details]
test program showing the problem

Description of problem:

The Ok button in the JFileChooser is so narrow in the GTK LookAndFeel that all you can see is the icon, not the text. This looks ridiculous.

Version-Release number of selected component (if applicable):

java-1.6.0-openjdk-1.6.0.0-49.1.9.3.fc14.x86_64


How reproducible:

Always.


Steps to Reproduce:
1. java -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel Test
  
Actual results:

Ok button is too narrow.

Expected results:

Ok button should be readable.

Comment 1 Joel Uckelman 2010-12-09 08:16:12 UTC
Created attachment 467700 [details]
screenshot of the problem

Comment 2 Omair Majid 2010-12-09 21:53:42 UTC
Can you please paste the result of:
xprop -root | grep - i xft

Thanks!

Comment 3 Joel Uckelman 2010-12-10 11:33:57 UTC
(In reply to comment #2)
> Can you please paste the result of:
> xprop -root | grep - i xft
> 
> Thanks!

I'm guessing that's supposed to be '-i', not '- i'?

[uckelman@scylla ~]$ xprop -root | grep -i xft
RESOURCE_MANAGER(STRING) = "Xft.antialias:\t1\nXft.dpi:\t96\nXft.hinting:\t1\nXft.hintstyle:\thintslight\nXft.rgba:\tnone\n"

Comment 4 Omair Majid 2010-12-10 19:17:39 UTC
(In reply to comment #3)
> > xprop -root | grep - i xft
> I'm guessing that's supposed to be '-i', not '- i'?

Yup. Sorry, my typo.

> [uckelman@scylla ~]$ xprop -root | grep -i xft
> RESOURCE_MANAGER(STRING) =
> "Xft.antialias:\t1\nXft.dpi:\t96\nXft.hinting:\t1\nXft.hintstyle:\thintslight\nXft.rgba:\tnone\n"

Hmm.. can you try changing your font settings to "Monochrome" or "Subpixel smoothing" using gnome-appearance-properties to see if that makes the problem disappear? If that fixes the problem, then I believe it is an issue with how text lengths are computed in the presence of antialiasing.

Thanks!

Comment 5 Joel Uckelman 2010-12-11 12:19:11 UTC
(In reply to comment #4)
> 
> Hmm.. can you try changing your font settings to "Monochrome" or "Subpixel
> smoothing" using gnome-appearance-properties to see if that makes the problem
> disappear? If that fixes the problem, then I believe it is an issue with how
> text lengths are computed in the presence of antialiasing.
> 
> Thanks!

With Monochrome, all the text shows up on the Ok button.

Switching the font rendering made me notice a related problem---the Cancel and Ok buttons aren't the same width, which also looks strange.

Comment 6 Omair Majid 2010-12-15 14:20:56 UTC
(In reply to comment #5)
> With Monochrome, all the text shows up on the Ok button.

Thanks. I think I know what this problem is. This has been fixed upstream in OpenJDK7 through http://hg.openjdk.java.net/jdk7/swing/jdk/rev/281fbd82a971. Unfortunately, backporting it to OpenJDK6 (or IcedTea6) is not trivial - there were lots of code changes (which are not public) in between. I will see if a simpler fix is possible.

> 
> Switching the font rendering made me notice a related problem---the Cancel and
> Ok buttons aren't the same width, which also looks strange.

This _should_ be simple enough to fix.

Comment 7 Omair Majid 2011-01-14 17:15:38 UTC
Created attachment 473559 [details]
result with same button sizes

This image shows how the buttons look with the same sizes. I am not sure if this is ideal.

Comment 8 Omair Majid 2011-01-14 17:17:45 UTC
Created attachment 473560 [details]
patch to make buttons the same size

Comment 9 Omair Majid 2011-01-14 22:18:21 UTC
The following two patches combined seem to do the trick.
http://hg.openjdk.java.net/jdk7/swing/jdk/rev/e78c2f17a60
http://hg.openjdk.java.net/jdk7/swing/jdk/rev/281fbd82a971

I will request a backport of these two patches

Comment 10 Joel Uckelman 2011-01-14 22:20:36 UTC
(In reply to comment #7)
> Created attachment 473559 [details]
> result with same button sizes
> 
> This image shows how the buttons look with the same sizes. I am not sure if
> this is ideal.

Buttons are equal width in all GNOME dialogs, though, so far as I've seen, so it would be inconsistent not to do it here.

Comment 11 Omair Majid 2011-01-25 15:43:04 UTC
(In reply to comment #10)
> Buttons are equal width in all GNOME dialogs, though, so far as I've seen, so
> it would be inconsistent not to do it here.

Good point. The Sun/Oracle engineers agree with your point.

I have backported the patches:
http://icedtea.classpath.org/hg/icedtea6/rev/c78edcdba40f
http://icedtea.classpath.org/hg/icedtea6/rev/974192ac0471

The next IcedTea6 version should include this fix.

Comment 12 Omair Majid 2012-03-26 18:03:05 UTC
The newer versions of icedtea6 (in F15 or later) should contain these fixes. But since F14 has been EOL'ed, the fix wont be added there. Sorry.