Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8054638

xrender: text drawn after setColor(Color.white) is actually black

XMLWordPrintable

    • 2d
    • b32
    • x86
    • linux

        FULL PRODUCT VERSION :
        java version "1.8.0_11"
        Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
        Java HotSpot(TM) Server VM (build 25.11-b03, mixed mode)


        ADDITIONAL OS VERSION INFORMATION :
        Linux t61 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:12 UTC 2014 i686 i686 i686 GNU/Linux

        EXTRA RELEVANT SYSTEM CONFIGURATION :
        not necessary

        A DESCRIPTION OF THE PROBLEM :
        White color is not painted. This applies only to Color(255, 255, 255). If
        we change it to Color(255, 255, 254), painting works as expected.

        This bug only affects Linux; on Windows everything works fine.

        REGRESSION. Last worked in version 7u65

        ADDITIONAL REGRESSION INFORMATION:
        java version "1.7.0_65"
        Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
        Java HotSpot(TM) Server VM (build 24.65-b04, mixed mode)


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Paint any shape in Color.white on Linux system with current JDK 1.8.


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        package com.zetcode;

        import java.awt.Color;
        import java.awt.EventQueue;
        import java.awt.Graphics;
        import javax.swing.JFrame;
        import javax.swing.JPanel;

        class Surface extends JPanel {
            
            public Surface() {
                
                setBackground(Color.black);
            }

            private void doDrawing(Graphics g) {

                g.setColor(new Color(255, 255, 255));
                g.drawString("Bookstore", 50, 50);
            }
            
            @Override
            public void paintComponent(Graphics g) {
                super.paintComponent(g);
                
                doDrawing(g);
            }
        }


        public class WhiteColorBug extends JFrame {
            
            
            public WhiteColorBug() {
                
                initUI();
            }

            private void initUI() {
                
                add(new Surface());
                
                setSize(280, 270);
                setTitle("White color bug");
                setLocationRelativeTo(null);
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            }
            

            public static void main(String[] args) {
                
                EventQueue.invokeLater(new Runnable() {
                    
                    @Override
                    public void run() {
                        WhiteColorBug ex = new WhiteColorBug();
                        ex.setVisible(true);
                    }
                });
            }
            
        }

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

        CUSTOMER SUBMITTED WORKAROUND :
        Paint in Color(255, 255, 254).

              ceisserer Clemens Eisserer
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: