All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ch.randelshofer.quaqua.snow_leopard.QuaquaSnowLeopardSideBarSelectionBorder Maven / Gradle / Ivy

Go to download

A Mavenisation of the Quaqua Mac OSX Swing Look and Feel (Java library) Quaqua Look and Feel (C) 2003-2010, Werner Randelshofer. Mavenisation by Matt Gumbley, DevZendo.org - for problems with Mavenisation, see Matt; for issues with Quaqua, see the Quaqua home page. For full license details, see http://randelshofer.ch/quaqua/license.html

The newest version!
/*
 * @(#)QuaquaSnowLeopardSideBarSelectionBorder.java
 *
 * Copyright (c) 2009-2010 Werner Randelshofer, Immensee, Switzerland.
 * All rights reserved.
 *
 * You may not use, copy or modify this file, except in compliance with the
 * license agreement you entered into with Werner Randelshofer.
 * For details see accompanying license terms.
 */
package ch.randelshofer.quaqua.snow_leopard;

import ch.randelshofer.quaqua.*;
import java.awt.*;
import java.awt.Insets;
import javax.swing.border.*;
import javax.swing.plaf.UIResource;

/**
 * QuaquaSnowLeopardSideBarSelectionBorder.
 *
 * @author Werner Randelshofer
 * @version $Id: QuaquaSnowLeopardSideBarSelectionBorder.java 363 2010-11-21 17:41:04Z wrandelshofer $
 */
public class QuaquaSnowLeopardSideBarSelectionBorder implements Border, UIResource {

    /** Creates a new instance. */
    public QuaquaSnowLeopardSideBarSelectionBorder() {
    }

    public void paintBorder(Component c, Graphics gr, int x, int y, int width, int height) {
        Graphics2D g = (Graphics2D) gr;
        if (QuaquaUtilities.isFocused(c)) {
            // top line: 0x5896d0
            g.setColor(new Color(0x5896d0));
            g.fillRect(x, y, width, 1);
            g.setPaint(new GradientPaint(
                    x, y + 1, new Color(0x6ea6d6),
                    x, y + height - 1, new Color(0x216cb7),
                    true));
        } else {
            if (QuaquaUtilities.isOnActiveWindow(c, true)) {
                // top line: 0xa2b1cb
                g.setColor(new Color(0xa2b1cb));
                g.fillRect(x, y, width, 1);
                g.setPaint(new GradientPaint(
                        x, y + 1, new Color(0xb1bfd8),
                        x, y + height - 1, new Color(0x8296b8),
                        true));

            } else {
                // top line: 0xa8a8a8
                g.setColor(new Color(0xa8a8a8));
                g.fillRect(x, y, width, 1);
                g.setPaint(new GradientPaint(
                        x, y + 1, new Color(0xc1c1c1),
                        x, y + height - 1, new Color(0x9c9c9c)));
            }
        }
        g.fillRect(x, y + 1, width, height - 1);
    }

    public Insets getBorderInsets(Component c) {
        return new Insets(0, 0, 0, 0);
    }

    public boolean isBorderOpaque() {
        return true;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy