Quaqua 8.0 2011-10-02

ch.randelshofer.quaqua.border
Class QuaquaNativeBorder

java.lang.Object
  extended by ch.randelshofer.quaqua.util.CachedPainter
      extended by ch.randelshofer.quaqua.border.QuaquaNativeBorder
All Implemented Interfaces:
VisualMargin, javax.swing.border.Border
Direct Known Subclasses:
QuaquaLionNativeScrollBarBorder, QuaquaLionNativeTabBorder, QuaquaNativeBorder.UIResource

public class QuaquaNativeBorder
extends CachedPainter
implements javax.swing.border.Border, VisualMargin

Native Aqua border for an AbstractButton. This border draws everything except the focus ring.

To draw the focus wring, wrap this border into a FocusedBorder.

This border is not suited for large components because it creates a temporary BufferedImage with the same size of the component.

Version:
$Id$
Author:
Werner Randelshofer

Nested Class Summary
static class QuaquaNativeBorder.UIResource
           
 
Field Summary
protected static int ARG_ACTIVE
           
protected static int ARG_DISABLED
           
protected static int ARG_FOCUSED
           
protected static int ARG_ORIENTATION
           
protected static int ARG_PRESSED
           
protected static int ARG_ROLLOVER
           
protected static int ARG_SEGPOS
           
protected static int ARG_SELECTED
           
protected static int ARG_SIZE_VARIANT
           
protected static int ARG_TRAILING_SEPARATOR
           
protected static int ARG_WIDGET
           
protected  java.awt.Insets borderInsets
           
protected  java.awt.Insets imageInsets
           
protected  OSXAquaPainter painter
           
 
Constructor Summary
QuaquaNativeBorder(int cacheSize, OSXAquaPainter.Widget widget)
           
QuaquaNativeBorder(int cacheSize, OSXAquaPainter.Widget widget, java.awt.Insets imageInsets, java.awt.Insets borderInsets)
           
QuaquaNativeBorder(OSXAquaPainter.Widget widget)
           
QuaquaNativeBorder(OSXAquaPainter.Widget widget, java.awt.Insets imageInsets, java.awt.Insets borderInsets)
           
 
Method Summary
protected  java.awt.Image createImage(java.awt.Component c, int w, int h, java.awt.GraphicsConfiguration config)
          Creates the image to cache.
 java.awt.Insets getBorderInsets(java.awt.Component c)
           
 java.awt.Insets getVisualMargin(java.awt.Component c)
           
 boolean isBorderOpaque()
           
 void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
           
protected  void paintToImage(java.awt.Component c, java.awt.Graphics g, int w, int h, java.lang.Object args)
          Paints the representation to cache to the supplied Graphics.
protected  void paintToImage(java.awt.Component c, java.awt.Image img, int w, int h, java.lang.Object args)
          Paints the representation to cache to the supplied Graphics.
 
Methods inherited from class ch.randelshofer.quaqua.util.CachedPainter
getMaxCachedImageSize, paint, paintImage, setMaxCachedImageSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

painter

protected OSXAquaPainter painter

imageInsets

protected java.awt.Insets imageInsets

borderInsets

protected java.awt.Insets borderInsets

ARG_ACTIVE

protected static final int ARG_ACTIVE
See Also:
Constant Field Values

ARG_PRESSED

protected static final int ARG_PRESSED
See Also:
Constant Field Values

ARG_DISABLED

protected static final int ARG_DISABLED
See Also:
Constant Field Values

ARG_ROLLOVER

protected static final int ARG_ROLLOVER
See Also:
Constant Field Values

ARG_SELECTED

protected static final int ARG_SELECTED
See Also:
Constant Field Values

ARG_FOCUSED

protected static final int ARG_FOCUSED
See Also:
Constant Field Values

ARG_SIZE_VARIANT

protected static final int ARG_SIZE_VARIANT
See Also:
Constant Field Values

ARG_SEGPOS

protected static final int ARG_SEGPOS
See Also:
Constant Field Values

ARG_WIDGET

protected static final int ARG_WIDGET
See Also:
Constant Field Values

ARG_TRAILING_SEPARATOR

protected static final int ARG_TRAILING_SEPARATOR
See Also:
Constant Field Values

ARG_ORIENTATION

protected static final int ARG_ORIENTATION
See Also:
Constant Field Values
Constructor Detail

QuaquaNativeBorder

public QuaquaNativeBorder(OSXAquaPainter.Widget widget)

QuaquaNativeBorder

public QuaquaNativeBorder(int cacheSize,
                          OSXAquaPainter.Widget widget)

QuaquaNativeBorder

public QuaquaNativeBorder(OSXAquaPainter.Widget widget,
                          java.awt.Insets imageInsets,
                          java.awt.Insets borderInsets)

QuaquaNativeBorder

public QuaquaNativeBorder(int cacheSize,
                          OSXAquaPainter.Widget widget,
                          java.awt.Insets imageInsets,
                          java.awt.Insets borderInsets)
Method Detail

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

createImage

protected java.awt.Image createImage(java.awt.Component c,
                                     int w,
                                     int h,
                                     java.awt.GraphicsConfiguration config)
Description copied from class: CachedPainter
Creates the image to cache. This returns an opaque image, subclasses that require translucency or transparency will need to override this method.

Overrides:
createImage in class CachedPainter
Parameters:
c - Component painting to
w - Width of image to create
h - Height to image to create
config - GraphicsConfiguration that will be rendered to, this may be null.

paintToImage

protected void paintToImage(java.awt.Component c,
                            java.awt.Image img,
                            int w,
                            int h,
                            java.lang.Object args)
Description copied from class: CachedPainter
Paints the representation to cache to the supplied Graphics.

Overrides:
paintToImage in class CachedPainter
Parameters:
c - Component painting to
img - Image to paint to
w - Width to paint to
h - Height to paint to
args - Arguments supplied to paint

paintToImage

protected void paintToImage(java.awt.Component c,
                            java.awt.Graphics g,
                            int w,
                            int h,
                            java.lang.Object args)
Description copied from class: CachedPainter
Paints the representation to cache to the supplied Graphics.

Specified by:
paintToImage in class CachedPainter
Parameters:
c - Component painting to
g - Graphics to paint to
w - Width to paint to
h - Height to paint to
args - Arguments supplied to paint

getBorderInsets

public java.awt.Insets getBorderInsets(java.awt.Component c)
Specified by:
getBorderInsets in interface javax.swing.border.Border

isBorderOpaque

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

getVisualMargin

public java.awt.Insets getVisualMargin(java.awt.Component c)
Specified by:
getVisualMargin in interface VisualMargin

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