public class AbstractImageBorder extends Object
Modifier and Type | Field | Description |
---|---|---|
protected BufferedImage |
borderImage |
|
protected Insets |
imageInsets |
Constructor | Description |
---|---|
AbstractImageBorder(BufferedImage borderImage,
Insets imageInsets) |
Creates a new ImageBorder using the supplied image and the insets
|
AbstractImageBorder(URL imageURL,
Insets imageInsets) |
Creates a new ImageBofder loading the image from the supplied URL
|
Modifier and Type | Method | Description |
---|---|---|
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
|
protected BufferedImage borderImage
protected Insets imageInsets
public AbstractImageBorder(URL imageURL, Insets imageInsets)
imageURL
- The location of the image to useimageInsets
- The insets around the edge of the image that allow the cookie-cut-and-stretch of the image
around the edge of the borderpublic AbstractImageBorder(BufferedImage borderImage, Insets imageInsets)
borderImage
- The image to be used as the borderimageInsets
- The insets around the edge of the image that allow the cookie-cut-and-stretch of the image
around the edge of the borderpublic void paintBorder(int compWidth, int compHeight, Graphics g, int x, int y, int width, int height)
compWidth
- width of the target componentcompHeight
- height of the target componentg
- The graphics contextx
- The x offsety
- The y offsetwidth
- The widthheight
- The heightpublic void setInsets(Insets insets)
insets
- The edges of the imagepublic Insets getImageInsets()
public void paintCenter(Graphics2D g2, int compWidth, int compHeight)
g2
- The graphics contextcompWidth
- width of the target componentcompHeight
- height of the target component