Is it reproduced only on Linux?

It looks like a known bug 8054638 xrender: text drawn after setColor(Color.white) is actually black
   https://bugs.openjdk.java.net/browse/JDK-8054638
which should have been already fixed in JDK 8u40.

Thanks,
Alexandr.

On 3/15/2015 5:19 PM, Christian Bürckert wrote:
Hi Support Team,

something seems to be wrong in the setForeground method of JLabel.
The following minimal example reproduces the error on my maschine.
As you can imagine a  WHITE text is expected but as screenshot jdk8.png
shows it's actually black. After changing to jdk7 the same program
behaves like expected (see screenshot jdk7.png).

(Exact jdk versions see at the end of the e-mail)


     public static void main(String[] args) throws Exception {
         JFrame jframe = new JFrame();
         jframe.setLayout(new FlowLayout());
         JLabel test = new JLabel();
         test.setText("This text should be white");
         test.setForeground(Color.WHITE);
         jframe.add(test);
         jframe.pack();
         jframe.setVisible(true);
         System.out.println(test.getForeground());
    }


java -version
openjdk version "1.8.0_31"
OpenJDK Runtime Environment (build 1.8.0_31-b13) OpenJDK 64-Bit Server
VM (build 25.31-b07, mixed mode)


java -version
java version "1.7.0_75"
OpenJDK Runtime Environment (IcedTea 2.5.4) (Arch Linux build
7.u75_2.5.4-1-x86_64)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)


Reply via email to