Groovy Documentation

com.blogofbug.swing.borders
[Java] Class AbstractImageBorder

java.lang.Object
  com.blogofbug.swing.borders.AbstractImageBorder

public class AbstractImageBorder
extends Object

Authors:
nigel


Field Summary
protected BufferedImage borderImage

protected Insets imageInsets

 
Constructor Summary
AbstractImageBorder(URL imageURL, Insets imageInsets)

Creates a new ImageBofder loading the image from the supplied URL

AbstractImageBorder(BufferedImage borderImage, Insets imageInsets)

Creates a new ImageBorder using the supplied image and the insets

 
Method Summary
private void drawSlice(Graphics2D g2, int sliceX, int sliceY, int sliceWidth, int sliceHeight, int destX, int destY)

Draws a slicde from the specified image onto the graphics area

Insets getImageInsets()

void paintBorder(int compWidth, int compHeight, Graphics g, int x, int y, int width, int height)

Paints the border around the specified component

void paintCenter(Graphics2D g2, int compWidth, int compHeight)

Paints a stretched version of the center of the image (as the border is drawn first, then the component paints itself) so that the component can use it in its own paint if the border lends itself to having a centre area over-painted

void setInsets(Insets insets)

Sets the insets around the edge of the image to be used to cookie cut the image into a border

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

borderImage

protected BufferedImage borderImage


imageInsets

protected Insets imageInsets


 
Constructor Detail

AbstractImageBorder

public AbstractImageBorder(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


AbstractImageBorder

public AbstractImageBorder(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


 
Method Detail

drawSlice

private void drawSlice(Graphics2D g2, int sliceX, int sliceY, int sliceWidth, int sliceHeight, int destX, int destY)
Draws a slicde from the specified image onto the graphics area
Parameters:
g2 - The graphics context to draw into
sliceX - The x-cordinate of the slice
sliceY - The y-cordinate of the slice
sliceWidth - The width of the slice
sliceHeight - The height of the slice
destX - The target location of the drawn slice
destY - The target location of the drawn slice


getImageInsets

public Insets getImageInsets()


paintBorder

public void paintBorder(int compWidth, int compHeight, Graphics g, int x, int y, int width, int height)
Paints the border around the specified component
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


paintCenter

public void paintCenter(Graphics2D g2, int compWidth, int compHeight)
Paints a stretched version of the center of the image (as the border is drawn first, then the component paints itself) so that the component can use it in its own paint if the border lends itself to having a centre area over-painted
Parameters:
g2 - The graphics context
c - The component


setInsets

public void setInsets(Insets insets)
Sets the insets around the edge of the image to be used to cookie cut the image into a border
Parameters:
insets - The edges of the image


 

Groovy Documentation