Package org.pushingpixels.lafwidget.contrib.blogofbug.swing.borders

# Class ImageBorder

java.lang.Object
javax.swing.border.AbstractBorder
org.pushingpixels.lafwidget.contrib.blogofbug.swing.borders.ImageBorder

All Implemented Interfaces:
  `Serializable`, `Border`

public class ImageBorder extends AbstractBorder
ImageBorder takes an image and breaks out the corners and the top, left, right, and bottom borders stretching them to fill the space around which the border is drawn

See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`protected AbstractImageBorder`
`borderRenderer`

## Constructor Summary

Constructors
Constructor
Description
`ImageBorder(BufferedImage borderImage, Insets imageInsets)`
Creates a new ImageBorder using the supplied image and the insets
`ImageBorder(URL imageURL, Insets imageInsets)`
Creates a new ImageBofder loading the image from the supplied URL

## Method Summary

Modifier and Type
Method
Description
`Insets`
`getBorderInsets(Component c)`
Gets the insets of the image back (subtracting from the component size would give you the renderable area
`Insets`
`getBorderInsets(Component c, Insets i)`
Gets the insets of the image and returns in the in the supplied Insets instance
`void`
`paintBorder(Component c, Graphics g, int x, int y, int width, int height)`
Paints the border around the specified component
`void`
`paintCenter(Graphics2D g2, Component c)`
`void`
`setPaintBorder(boolean paintBorder)`
Controls wether or not the border is actually painted or not.

### Methods inherited from class javax.swing.border.AbstractBorder

`getBaseline, getBaselineResizeBehavior, getInteriorRectangle, getInteriorRectangle, isBorderOpaque`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### borderRenderer

protected AbstractImageBorder borderRenderer

## Constructor Details

### ImageBorder

public ImageBorder(BufferedImage borderImage, Insets imageInsets)
Creates a new ImageBorder using the supplied image and the insets

Parameters:
  `borderImage` - The image to be used as the border
  `imageInsets` - The insets around the edge of the image that allow the cookie-cut-and-stretch of the image around the edge of the border

### ImageBorder

public ImageBorder(URL imageURL, Insets imageInsets)
Creates a new ImageBofder loading the image from the supplied URL

Parameters:
  `imageURL` - The location of the image to use
  `imageInsets` - The insets around the edge of the image that allow the cookie-cut-and-stretch of the image around the edge of the border

## Method Details

### paintBorder

public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
Paints the border around the specified component

Specified by:
  `paintBorder` in interface `Border`
Overrides:
  `paintBorder` in class `AbstractBorder`
Parameters:
  `c` - The component to paint the border on
  `g` - The graphics context
  `x` - The x offset
  `y` - The y offset
  `width` - The width
  `height` - The height

### setPaintBorder

public void setPaintBorder(boolean paintBorder)
Controls wether or not the border is actually painted or not.

Parameters:
  `paintBorder` - If false then will not draw the border. Useful if the border is being used to show a selected item

### getBorderInsets

public Insets getBorderInsets(Component c)
Gets the insets of the image back (subtracting from the component size would give you the renderable area

Specified by:
  `getBorderInsets` in interface `Border`
Overrides:
  `getBorderInsets` in class `AbstractBorder`
Parameters:
  `c` - The component to which the border will be applied
Returns:
  The insets of the border

### getBorderInsets

public Insets getBorderInsets(Component c, Insets i)
Gets the insets of the image and returns in the in the supplied Insets instance

Overrides:
  `getBorderInsets` in class `AbstractBorder`
Parameters:
  `c` - The component to which the border will be applied
  `i` - A pre-created insets object
Returns:
  The insets of the border

### paintCenter

public void paintCenter(Graphics2D g2, Component c)