Quaqua 8.0 2011-10-02

ch.randelshofer.quaqua
Class QuaquaButtonBorder

java.lang.Object
  extended by ch.randelshofer.quaqua.QuaquaButtonBorder
All Implemented Interfaces:
PressedCueBorder, javax.swing.border.Border, javax.swing.plaf.UIResource

public class QuaquaButtonBorder
extends java.lang.Object
implements javax.swing.border.Border, PressedCueBorder, javax.swing.plaf.UIResource

QuaquaButtonBorder. This border uses client properties and font sizes of a JComponent to determine which style the border shall have. For some styles, the JComponent should honour size constrictions.

The following values of the client property Quaqua.Button.style are supported:

If the Quaqua.Button.style property is missing, then the following values of the client property JButton.buttonType are supported:

Version:
$Id: QuaquaButtonBorder.java 438 2011-08-09 22:13:41Z wrandelshofer $
Author:
Werner Randelshofer

Constructor Summary
QuaquaButtonBorder(java.lang.String defaultStyle)
          Creates a new instance.
 
Method Summary
 javax.swing.border.Border getActualBorder(java.awt.Component c)
          Returns a Border that implements the VisualMargin interface.
 java.awt.Insets getBorderInsets(java.awt.Component c)
          Returns true, if this border has a visual cue for the disabled state of the button.
 java.awt.Insets getDefaultMargin(javax.swing.JComponent c)
          Returns the default button margin for the specified component.
protected  java.lang.String getStyle(java.awt.Component c)
           
 java.awt.Insets getVisualMargin(java.awt.Component c)
           
 boolean hasPressedCue(javax.swing.JComponent c)
          Returns true, if this border has a visual cue for the pressed state of the button.
 boolean isBorderOpaque()
           
 boolean isFixedHeight(javax.swing.JComponent c)
           
 void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuaquaButtonBorder

public QuaquaButtonBorder(java.lang.String defaultStyle)
Creates a new instance.

Method Detail

getActualBorder

public javax.swing.border.Border getActualBorder(java.awt.Component c)
Returns a Border that implements the VisualMargin interface.


getDefaultMargin

public java.awt.Insets getDefaultMargin(javax.swing.JComponent c)
Returns the default button margin for the specified component. FIXME: We should not create a new Insets instance on each method call.


isFixedHeight

public boolean isFixedHeight(javax.swing.JComponent c)

getStyle

protected java.lang.String getStyle(java.awt.Component c)

hasPressedCue

public boolean hasPressedCue(javax.swing.JComponent c)
Returns true, if this border has a visual cue for the pressed state of the button. If the border has no visual cue, then the ButtonUI has to provide it by some other means.

Specified by:
hasPressedCue in interface PressedCueBorder

getVisualMargin

public java.awt.Insets getVisualMargin(java.awt.Component c)

getBorderInsets

public java.awt.Insets getBorderInsets(java.awt.Component c)
Returns true, if this border has a visual cue for the disabled state of the button. If the border has no visual cue, then the ButtonUI has to provide it by some other means. / public boolean hasDisabledCue(JComponent c) { return false; }

Specified by:
getBorderInsets in interface javax.swing.border.Border

isBorderOpaque

public boolean isBorderOpaque()
Specified by:
isBorderOpaque in interface javax.swing.border.Border

paintBorder

public void paintBorder(java.awt.Component c,
                        java.awt.Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
Specified by:
paintBorder in interface javax.swing.border.Border

Copyright 2003-2007 (c) Werner Randelshofer.
All rights reserved.