Class ImageBorder
java.lang.Object
javax.swing.border.AbstractBorder
org.pushingpixels.lafwidget.contrib.blogofbug.swing.borders.ImageBorder
- All Implemented Interfaces:
Serializable
,Border
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:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionImageBorder
(BufferedImage borderImage, Insets imageInsets) Creates a new ImageBorder using the supplied image and the insetsImageBorder
(URL imageURL, Insets imageInsets) Creates a new ImageBofder loading the image from the supplied URL -
Method Summary
Modifier and TypeMethodDescriptionGets the insets of the image back (subtracting from the component size would give you the renderable areagetBorderInsets
(Component c, Insets i) Gets the insets of the image and returns in the in the supplied Insets instancevoid
paintBorder
(Component c, Graphics g, int x, int y, int width, int height) Paints the border around the specified componentvoid
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
-
Field Details
-
borderRenderer
-
-
Constructor Details
-
ImageBorder
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
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 Details
-
paintBorder
Paints the border around the specified component- Specified by:
paintBorder
in interfaceBorder
- Overrides:
paintBorder
in classAbstractBorder
- 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
Gets the insets of the image back (subtracting from the component size would give you the renderable area- Specified by:
getBorderInsets
in interfaceBorder
- Overrides:
getBorderInsets
in classAbstractBorder
- Parameters:
c
- The component to which the border will be applied- Returns:
- The insets of the border
-
getBorderInsets
Gets the insets of the image and returns in the in the supplied Insets instance- Overrides:
getBorderInsets
in classAbstractBorder
- Parameters:
c
- The component to which the border will be appliedi
- A pre-created insets object- Returns:
- The insets of the border
-
paintCenter
-