ch.randelshofer.quaqua.QuaquaButtonMarginBorder 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!
/*
* @(#)QuaquaButtonMarginBorder.java
*
* 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;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
/**
* QuaquaButtonMarginBorder is used to honour the margins between button text
* and button border.
*
* @author Werner Randelshofer
* @version $Id: QuaquaButtonMarginBorder.java 361 2010-11-21 11:19:20Z wrandelshofer $
*/
public class QuaquaButtonMarginBorder extends AbstractBorder {
public Insets getBorderInsets(Component c) {
return getBorderInsets(c, new Insets(0, 0, 0, 0));
}
/**
* Reinitializes the insets parameter with this Border's current Insets.
* @param c the component for which this border insets value applies
* @param insets the object to be reinitialized
* @return the insets
object
*/
public Insets getBorderInsets(Component c, Insets insets) {
if (c instanceof AbstractButton) {
AbstractButton b = (AbstractButton) c;
Insets margin = b.getMargin();
/*
if (margin == null) {
margin = getDefaultMargin((JComponent) c);
}*/
if (margin != null) {
insets.top += margin.top;
insets.left += margin.left;
insets.bottom += margin.bottom;
insets.right += margin.right;
}
}
return insets;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy