ch.randelshofer.quaqua.icon.OverlayIcon 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!
/*
* @(#)CompositeIcon.java 1.0 20 March 2005
*
* Copyright (c) 2004-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.icon;
import javax.swing.*;
import java.awt.*;
/**
* OverlayIcon.
*
* @author Werner Randelshofer
* @version 1.0 20 March 2005 Created.
*/
public class OverlayIcon implements Icon {
private Icon[] icons;
/**
* Creates a new instance.
* Constructor with objects only used by BasicQuaquaLookAndFeel classes.
* This constructor helps to reduce startuc latency, because we don't
* need to load the Icon interface during the first creation of
* BasicQuaquaLookAndFeel class.
*/
public OverlayIcon(Object first, Object second) {
this((Icon) first, (Icon) second);
}
/** Creates a new instance. */
public OverlayIcon(Icon first, Icon second) {
this.icons = new Icon[] { first, second };
}
public int getIconHeight() {
return icons[0].getIconHeight();
}
public int getIconWidth() {
return icons[0].getIconWidth();
}
public void paintIcon(Component c, Graphics g, int x, int y) {
for (int i=0; i < icons.length; i++) {
if (icons[i]!=null) {
icons[i].paintIcon(c, g, x, y);
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy