ch.randelshofer.quaqua.tiger.QuaquaTigerSideBarSelectionBorder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Quaqua Show documentation
Show all versions of Quaqua Show documentation
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!
/*
* @(#)QuaquaTigerSideBarSelectionBorder.java
*
* Copyright (c) 2007-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.tiger;
import ch.randelshofer.quaqua.*;
import java.awt.*;
import java.awt.Insets;
import javax.swing.border.*;
import javax.swing.plaf.UIResource;
/**
* QuaquaTigerSideBarSelectionBorder.
*
* @author Werner Randelshofer
* @version $Id$
*/
public class QuaquaTigerSideBarSelectionBorder implements Border, UIResource {
/** Creates a new instance. */
public QuaquaTigerSideBarSelectionBorder() {
}
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
g.setColor(new Color(0xadbbd0));
g.fillRect(x, y, width, 1);
g.setPaint(new GradientPaint(
x, y + 1, new Color(0xacbacf),
x, y + height - 2, new Color(0x98aac4),
true));
g.fillRect(x, y + 1, width, height - 1);
// bottom line
g.setColor(new Color(0x8c98b0));
g.fillRect(x, y + height - 1, width, 1);
} else {
if (QuaquaUtilities.isOnActiveWindow(c, true)) {
// top line
g.setColor(new Color(0xadbbd0));
g.fillRect(x, y, width, 1);
g.setPaint(new GradientPaint(
x, y + 1, new Color(0xacbacf),
x, y + height - 2, new Color(0x98aac4),
true));
g.fillRect(x, y + 1, width, height - 1);
// bottom line
g.setColor(new Color(0x8c98b0));
g.fillRect(x, y + height - 1, width, 1);
} else {
// top line
g.setColor(new Color(0xadbbd0));
g.fillRect(x, y, width, 1);
g.setPaint(new GradientPaint(
x, y + 1, new Color(0xacbacf),
x, y + height - 2, new Color(0x98aac4),
true));
g.fillRect(x, y + 1, width, height - 1);
// bottom line
g.setColor(new Color(0x8c98b0));
g.fillRect(x, y + height - 1, width, 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