test/jdk/java/awt/Color/AlphaColorTest.java
changeset 55701 20c686ec8135
parent 51305 331888ea4a78
equal deleted inserted replaced
55700:1bb102c1cf27 55701:20c686ec8135
     1 /*
     1 /*
     2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    22  */
    22  */
    23 
    23 
    24 /**
    24 /**
    25  * @test
    25  * @test
    26  * @key headful
    26  * @key headful
    27  * @bug 8204931
    27  * @bug 8204931 8227392 8224825
    28  * @summary test alpha colors are blended with background.
    28  * @summary test alpha colors are blended with background.
    29  */
    29  */
    30 
    30 
    31 import java.awt.Color;
    31 import java.awt.Color;
    32 import java.awt.Component;
    32 import java.awt.Component;
    71         }
    71         }
    72      }
    72      }
    73 
    73 
    74     static Frame frame;
    74     static Frame frame;
    75     private static void createAndShowGUI() {
    75     private static void createAndShowGUI() {
    76         frame = new Frame("Alpha Color Test");
    76         frame = new Frame("Alpha Color Test") {
    77         frame.setBackground(Color.black);
    77             @Override
       
    78             public void paint(Graphics g) {
       
    79                 g.setColor(Color.black);
       
    80                 g.fillRect(0, 0, getWidth(), getHeight());
       
    81                 super.paint(g);
       
    82             }
       
    83         };
    78         Color color = new Color(255, 255, 255, 127);
    84         Color color = new Color(255, 255, 255, 127);
    79         frame.add("Center", new AlphaColorTest(color));
    85         frame.add("Center", new AlphaColorTest(color));
    80         frame.pack();
    86         frame.pack();
    81         frame.setVisible(true);
    87         frame.setVisible(true);
    82     }
    88     }