Bug 459967 - JTextPane.setBackground() fails when using GTK LookAndFeel
Summary: JTextPane.setBackground() fails when using GTK LookAndFeel
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: java-1.6.0-openjdk
Version: 15
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Omair Majid
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-08-25 12:16 UTC by Joel Uckelman
Modified: 2012-08-06 19:58 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-08-06 19:55:18 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
test program (719 bytes, text/x-java)
2008-08-25 12:16 UTC, Joel Uckelman
no flags Details
a potential fix (1.15 KB, patch)
2010-09-16 14:00 UTC, Omair Majid
no flags Details | Diff

Description Joel Uckelman 2008-08-25 12:16:02 UTC
Created attachment 314921 [details]
test program

Description of problem:

When using the GTL LookAndFeel, JTextPane.setBackground() is ignored. It worked 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):

java-1.6.0-openjdk-1.6.0.0-0.16.b09.fc9.x86_64


How reproducible:

Always.


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

The first run of the test program will use the default Metal LookAndFeel. Both JVMs I've tested (1.6.0_07-b06, and OpenJDK 1.6.0-b09) give the expected result. The second run of the test program will use the GTK LookAndFeel. With Sun's 1.6.0_07-b06, I get the expected result, but with OpenJDK 1.6.0-b09 the text has a white background while the surrounding panel has a grey background.

Expected results:

The background of the text should be the same color as the background of the surrounding panel.


Additional info:

I've yet to find a workaround for this, so it completely blocks me from using JTextPane. This used to work, and JTextPane.setForeground() works properly now and seems like it should work the same way as JTextPane.setBackground().

Comment 1 Joel Uckelman 2008-10-11 13:35:00 UTC
I've installed the OpenJDK packages from the Fedora 10 Beta (java-1.6.0-openjdk-1.6.0.0-0.20.b11.fc10.x86_64) and this problem is still present.

Comment 2 Joel Uckelman 2008-11-29 14:50:00 UTC
This problem is still present in java-1.6.0-openjdk-1.6.0.0-6.b12.fc10.x86_64 from Fedora 10.

Comment 3 Omair Majid 2009-01-22 19:34:06 UTC
Hi Joel,

I posted the question to swing-dev: http://mail.openjdk.java.net/pipermail/swing-dev/2009-January/000366.html

To summarize: when using the native look and feel (on any platform), the user's theme settings are used, and the programmer assignments are likely to be ignored. Please see the thread for details. 

Cheers

Comment 4 Joel Uckelman 2009-01-22 20:00:45 UTC
The way I found this bug is that I was subclassing JTextPane in order to get a label which would support both word wrap and full justification of text. So in this case, the correct background color is really not what the theme thinks should be the background color for a JTextPane, but rather what the theme thinks should be the background color for a JLabel.

This kind of policy makes the uses to which components can be put very narrow if you're using a native L&F. To be clear: What I want to achieve is to have this component of mine to have the same background color as a JLabel, because it *is* functionally a JLabel, despite that it inherits from JTextPane. I'm not trying to circumvent the color scheme provided by the L&F here, I'm trying to follow it---so it's very disheartening to read the replies you received.

Comment 5 Joel Uckelman 2009-01-22 20:18:20 UTC
I appreciate your efforts in tracking down what the expected behavior is. If this is officially Not a Bug, how does one do what I'm trying to do?

Comment 6 Mark Wielaard 2009-01-22 20:35:26 UTC
(In reply to comment #5)
> I appreciate your efforts in tracking down what the expected behavior is. If
> this is officially Not a Bug, how does one do what I'm trying to do?

I would suggest replying to the upstream thread and explaining what you want to do:
http://thread.gmane.org/gmane.comp.java.openjdk.swing.devel/363

Comment 7 Joel Uckelman 2009-02-12 11:22:35 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > I appreciate your efforts in tracking down what the expected behavior is. If
> > this is officially Not a Bug, how does one do what I'm trying to do?
> 
> I would suggest replying to the upstream thread and explaining what you want to
> do:
> http://thread.gmane.org/gmane.comp.java.openjdk.swing.devel/363

I tried, but was unable to get anyone on that list to offer an alternative way of specifying which role a component is carrying out so that it gets the right background color from the L&F. (In fact, there was one guy who seemed to agree with my original contention that this is a bug, if there's no alternative.)

Comment 8 Bug Zapper 2009-11-18 08:18:34 UTC
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 9 Bug Zapper 2010-04-27 12:12:27 UTC
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 10 Joel Uckelman 2010-04-27 12:32:24 UTC
This problem is still unresolved in Fedora 12.

Comment 12 Omair Majid 2010-09-16 14:00:45 UTC
Created attachment 447751 [details]
a potential fix

This is a quick-and-dirty patch that allows changing the background color of a JTextPane (and potentially other JComponents).

However, I do not think IcedTea or Fedora will accept this patch until the OpenJDK developers are happy with it.

Comment 13 Joel Uckelman 2010-09-17 20:29:24 UTC
Still happens with java-1.6.0-openjdk-1.6.0.0-42.b18.fc13.x86_64.

How do we impress on the OpenJDK devs that this matters?

Comment 14 Joel Uckelman 2010-09-17 20:32:14 UTC
Problem still happens in java-1.6.0-openjdk-1.6.0.0-42.b18.fc13.x86_64.

What do we need to do to get the OpenJDK devs to recognize that this is a problem?

Comment 15 Bug Zapper 2011-06-02 18:28:53 UTC
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '13'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 13's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 13 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 16 Fedora End Of Life 2012-08-06 19:55:18 UTC
This message is a notice that Fedora 15 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 15. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 15 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 17 Fedora End Of Life 2012-08-06 19:58:08 UTC
This message is a notice that Fedora 15 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 15. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 15 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping


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