Class AbstractImageBorder
- java.lang.Object
-
- org.pushingpixels.radiance.theming.extras.internal.contrib.blogofbug.swing.borders.AbstractImageBorder
-
public class AbstractImageBorder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.image.BufferedImage
borderImage
protected java.awt.Insets
imageInsets
-
Constructor Summary
Constructors Constructor Description AbstractImageBorder(java.awt.image.BufferedImage borderImage, java.awt.Insets imageInsets)
Creates a new ImageBorder using the supplied image and the insetsAbstractImageBorder(java.net.URL imageURL, java.awt.Insets imageInsets)
Creates a new ImageBorder loading the image from the supplied URL
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
drawSlice(java.awt.Graphics2D g2, int sliceX, int sliceY, int sliceWidth, int sliceHeight, int destX, int destY)
Draws a slicde from the specified image onto the graphics areajava.awt.Insets
getImageInsets()
void
paintBorder(int compWidth, int compHeight, java.awt.Graphics g, int x, int y, int width, int height)
Paints the border around the specified componentvoid
paintCenter(java.awt.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-paintedvoid
setInsets(java.awt.Insets insets)
Sets the insets around the edge of the image to be used to cookie cut the image into a border
-
-
-
Constructor Detail
-
AbstractImageBorder
public AbstractImageBorder(java.net.URL imageURL, java.awt.Insets imageInsets)
Creates a new ImageBorder loading the image from the supplied URL- Parameters:
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 border
-
AbstractImageBorder
public AbstractImageBorder(java.awt.image.BufferedImage borderImage, java.awt.Insets imageInsets)
Creates a new ImageBorder using the supplied image and the insets- Parameters:
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 border
-
-
Method Detail
-
paintBorder
public void paintBorder(int compWidth, int compHeight, java.awt.Graphics g, int x, int y, int width, int height)
Paints the border around the specified component- Parameters:
compWidth
- Component widthcompHeight
- Component heightg
- The graphics contextx
- The x offsety
- The y offsetwidth
- The widthheight
- The height
-
setInsets
public void setInsets(java.awt.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
-
getImageInsets
public java.awt.Insets getImageInsets()
-
paintCenter
public void paintCenter(java.awt.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 contextcompWidth
- Component widthcompHeight
- Component height
-
drawSlice
private void drawSlice(java.awt.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 intosliceX
- The x-cordinate of the slicesliceY
- The y-cordinate of the slicesliceWidth
- The width of the slicesliceHeight
- The height of the slicedestX
- The target location of the drawn slicedestY
- The target location of the drawn slice
-
-