JDK-8056009 : Incorrect font color when using xrender backend
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 8u20
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2014-08-25
  • Updated: 2014-08-26
  • Resolved: 2014-08-26
Related Reports
Duplicate :  
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Linux silakka 3.15.10-200.fc20.x86_64 #1 SMP Thu Aug 14 15:39:24 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Linux hauki 3.15.10-200.fc20.i686 #1 SMP Thu Aug 14 16:12:39 UTC 2014 i686 i686 i386 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
I some conditions font color can black, despite explicitly set to white. This happens *only* when using the xrender backend; X11 and OpenGL backends produce the expected results. Also, white seems to be the only color with the issue.

REGRESSION.  Last worked in version 7u65

ADDITIONAL REGRESSION INFORMATION: 
java version "1.7.0_65"
OpenJDK Runtime Environment (fedora-2.5.1.3.fc20-x86_64 u65-b17)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the included sample program.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The button should have white text, with white underlined T.
ACTUAL -
The button text is black, but the underline is white as expected.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class FontTest {
	private FontTest() {
		JFrame frame = new JFrame();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		JButton btn = new JButton();
		btn.setAction(new AbstractAction("Test") {
			{
				putValue(Action.MNEMONIC_KEY, KeyEvent.VK_T);
			}
			@Override
			public void actionPerformed(ActionEvent e) {	
			}
		});
		// Other colors than white apparently work
		btn.setForeground(Color.WHITE);
		frame.add(btn);
		frame.pack();
		frame.setVisible(true);
	}

	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			@Override
			public void run() {
				new FontTest();
			}
		});
	}
}

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

CUSTOMER SUBMITTED WORKAROUND :
Using either X11 or OpenGL backend. Alternatively, using slightly off-white color.