3078N/A/*
3078N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3078N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3078N/A *
3078N/A * This code is free software; you can redistribute it and/or modify it
3078N/A * under the terms of the GNU General Public License version 2 only, as
3078N/A * published by the Free Software Foundation.
3078N/A *
3078N/A * This code is distributed in the hope that it will be useful, but WITHOUT
3078N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3078N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3078N/A * version 2 for more details (a copy is included in the LICENSE file that
3078N/A * accompanied this code).
3078N/A *
3078N/A * You should have received a copy of the GNU General Public License version
3078N/A * 2 along with this work; if not, write to the Free Software Foundation,
3078N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3078N/A *
3078N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3078N/A * or visit www.oracle.com if you need additional information or have any
3078N/A * questions.
3078N/A */
3078N/A
3078N/A/*
3078N/A @test
3078N/A @bug 6783910
3078N/A @summary java.awt.Color.brighter()/darker() methods make color opaque
3078N/A @author Andrei Dmitriev: area=awt-color
3078N/A @run main OpacityChange
3078N/A*/
3078N/A
3078N/Aimport java.awt.*;
3078N/A
3078N/Apublic class OpacityChange {
3078N/A private final static int INITIAL_ALPHA = 125;
3078N/A
3078N/A public static void main(String argv[]) {
3078N/A Color color = new Color(20, 20, 20, INITIAL_ALPHA);
3078N/A System.out.println("Initial alpha: " + color.getAlpha());
3078N/A Color colorBrighter = color.brighter();
3078N/A System.out.println("New alpha (after brighter): " + colorBrighter.getAlpha());
3078N/A
3078N/A Color colorDarker = color.darker();
3078N/A System.out.println("New alpha (after darker): " + colorDarker.getAlpha());
3078N/A
3078N/A
3078N/A if (INITIAL_ALPHA != colorBrighter.getAlpha()) {
3078N/A throw new RuntimeException("Brighter color alpha has changed from : " +INITIAL_ALPHA + " to " + colorBrighter.getAlpha());
3078N/A }
3078N/A if (INITIAL_ALPHA != colorDarker.getAlpha()) {
3078N/A throw new RuntimeException("Darker color alpha has changed from : " +INITIAL_ALPHA + " to " + colorDarker.getAlpha());
3078N/A }
3078N/A }
3078N/A}