Class ImageBorder
- java.lang.Object
-
- javax.swing.border.AbstractBorder
-
- org.pushingpixels.radiance.theming.extras.internal.contrib.blogofbug.swing.borders.ImageBorder
-
- All Implemented Interfaces:
java.io.Serializable
,javax.swing.border.Border
public class ImageBorder extends javax.swing.border.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
(package private) boolean
paintBorder
-
Constructor Summary
Constructors Constructor Description ImageBorder(java.awt.image.BufferedImage borderImage, java.awt.Insets imageInsets)
Creates a new ImageBorder using the supplied image and the insetsImageBorder(java.net.URL imageURL, java.awt.Insets imageInsets)
Creates a new ImageBofder loading the image from the supplied URL
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Insets
getBorderInsets(java.awt.Component c)
Gets the insets of the image back (subtracting from the component size would give you the renderable areajava.awt.Insets
getBorderInsets(java.awt.Component c, java.awt.Insets i)
Gets the insets of the image and returns in the in the supplied Insets instancevoid
paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
Paints the border around the specified componentvoid
paintCenter(java.awt.Graphics2D g2, java.awt.Component c)
void
setPaintBorder(boolean paintBorder)
Controls wether or not the border is actually painted or not.
-
-
-
Field Detail
-
borderRenderer
protected AbstractImageBorder borderRenderer
-
paintBorder
boolean paintBorder
-
-
Constructor Detail
-
ImageBorder
public ImageBorder(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
-
ImageBorder
public ImageBorder(java.net.URL imageURL, java.awt.Insets imageInsets)
Creates a new ImageBofder 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
-
-
Method Detail
-
paintBorder
public void paintBorder(java.awt.Component c, java.awt.Graphics g, int x, int y, int width, int height)
Paints the border around the specified component- Specified by:
paintBorder
in interfacejavax.swing.border.Border
- Overrides:
paintBorder
in classjavax.swing.border.AbstractBorder
- Parameters:
c
- The component to paint the border ong
- The graphics contextx
- The x offsety
- The y offsetwidth
- The widthheight
- 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 java.awt.Insets getBorderInsets(java.awt.Component c)
Gets the insets of the image back (subtracting from the component size would give you the renderable area- Specified by:
getBorderInsets
in interfacejavax.swing.border.Border
- Overrides:
getBorderInsets
in classjavax.swing.border.AbstractBorder
- Parameters:
c
- The component to which the border will be applied- Returns:
- The insets of the border
-
getBorderInsets
public java.awt.Insets getBorderInsets(java.awt.Component c, java.awt.Insets i)
Gets the insets of the image and returns in the in the supplied Insets instance- Overrides:
getBorderInsets
in classjavax.swing.border.AbstractBorder
- Parameters:
c
- The component to which the border will be appliedi
- A pre-created insets object- Returns:
- The insets of the border
-
paintCenter
public void paintCenter(java.awt.Graphics2D g2, java.awt.Component c)
-
-