org.jdesktop.swingx.util
Class PaintUtils
java.lang.Object
org.jdesktop.swingx.util.PaintUtils
public class PaintUtils
- extends Object
A collection of utilties for painting visual effects.
Method Summary |
static BufferedImage |
convertToBufferedImage(Image img)
Deprecated. Use GraphicsUtilities.convertToBufferedImage(Image) instead |
static BufferedImage |
createCompatibleImage(int width,
int height)
Deprecated. (pre-0.9.6) use GraphicsUtilities.createCompatibleImage(int, int) |
static BufferedImage |
createCompatibleImage(int width,
int height,
int transparency)
Deprecated. (pre-0.9.6) use
GraphicsUtilities.createCompatibleImage(int, int) or
GraphicsUtilities.createCompatibleTranslucentImage(int, int) |
static Border |
getDefaultBorder()
Deprecated. (pre 0.9.6) no replacement |
static Rectangle |
getTextBounds(Graphics g,
JLabel label)
Returns the bounds that the text of a label will be drawn into. |
static BufferedImage |
loadCompatibleImage(InputStream in)
Deprecated. Use GraphicsUtilities.loadCompatibleImage(InputStream) instead |
static BufferedImage |
loadCompatibleImage(URL resource)
Deprecated. (pre-0.9.6) use GraphicsUtilities.loadCompatibleImage(URL) |
static void |
paintGradient(Graphics g,
JComponent comp,
Color color1,
Color color2)
Paints a top to bottom gradient fill over the component bounds
from color1 to color2. |
static Paint |
resizeGradient(Paint p,
int width,
int height)
Resizes a gradient to fill the width and height available. |
static void |
setBackgroundColor(Container cont,
Color color)
Deprecated. (pre 0.9.6) use
SwingXUtilities.setComponentTreeBackground(Component, Color) |
static void |
setFont(Container cont,
Font font)
Deprecated. (pre 0.9.6) use
SwingXUtilities.setComponentTreeFont(Component, Font) |
static void |
setForegroundColor(Container cont,
Color color)
Deprecated. (pre 0.9.6) use
SwingXUtilities.setComponentTreeForeground(Component, Color) |
static Shape |
setMergedClip(Graphics g,
Shape newClip)
Deprecated. (pre-0.9.6) Use GraphicsUtilities.mergeClip(Graphics,Shape) instead |
static BufferedImage |
toCompatibleImage(BufferedImage image)
Deprecated. (pre-0.9.6) use GraphicsUtilities.toCompatibleImage(BufferedImage) |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BLUE_EXPERIENCE
public static final GradientPaint BLUE_EXPERIENCE
MAC_OSX_SELECTED
public static final GradientPaint MAC_OSX_SELECTED
MAC_OSX
public static final GradientPaint MAC_OSX
AERITH
public static final GradientPaint AERITH
GRAY
public static final GradientPaint GRAY
RED_XP
public static final GradientPaint RED_XP
NIGHT_GRAY
public static final GradientPaint NIGHT_GRAY
NIGHT_GRAY_LIGHT
public static final GradientPaint NIGHT_GRAY_LIGHT
getDefaultBorder
@Deprecated
public static Border getDefaultBorder()
- Deprecated. (pre 0.9.6) no replacement
getTextBounds
public static Rectangle getTextBounds(Graphics g,
JLabel label)
- Returns the bounds that the text of a label will be drawn into.
Takes into account the current font metrics.
paintGradient
public static void paintGradient(Graphics g,
JComponent comp,
Color color1,
Color color2)
- Paints a top to bottom gradient fill over the component bounds
from color1 to color2.
setBackgroundColor
@Deprecated
public static void setBackgroundColor(Container cont,
Color color)
- Deprecated. (pre 0.9.6) use
SwingXUtilities.setComponentTreeBackground(Component, Color)
- Sets the background color for a containment hierarchy.
setForegroundColor
@Deprecated
public static void setForegroundColor(Container cont,
Color color)
- Deprecated. (pre 0.9.6) use
SwingXUtilities.setComponentTreeForeground(Component, Color)
- Sets the foreground color for a containment hierarchy.
setFont
@Deprecated
public static void setFont(Container cont,
Font font)
- Deprecated. (pre 0.9.6) use
SwingXUtilities.setComponentTreeFont(Component, Font)
- Sets the font for a containment hierarchy.
createCompatibleImage
@Deprecated
public static BufferedImage createCompatibleImage(int width,
int height)
- Deprecated. (pre-0.9.6) use
GraphicsUtilities.createCompatibleImage(int, int)
- Parameters:
width
- the width of the new BufferedImageheight
- the height of the new BufferedImage
- Returns:
- Creates and returns a BufferedImage that is "compatible" with this machines
video card and subsystem
createCompatibleImage
@Deprecated
public static BufferedImage createCompatibleImage(int width,
int height,
int transparency)
- Deprecated. (pre-0.9.6) use
GraphicsUtilities.createCompatibleImage(int, int)
or
GraphicsUtilities.createCompatibleTranslucentImage(int, int)
- Parameters:
width
- the width of the new BufferedImageheight
- the height of the new BufferedImagetransparency
- one of the values in the Transparency interface
- Returns:
- Creates and returns a BufferedImage that is "compatible" with
this machines video card and subsystem with the given
Transparency.
convertToBufferedImage
@Deprecated
public static BufferedImage convertToBufferedImage(Image img)
- Deprecated. Use
GraphicsUtilities.convertToBufferedImage(Image)
instead
loadCompatibleImage
@Deprecated
public static BufferedImage loadCompatibleImage(URL resource)
throws IOException
- Deprecated. (pre-0.9.6) use
GraphicsUtilities.loadCompatibleImage(URL)
- Loads the image at the URL and makes it compatible with the screen.
If loading the url fails then this method will either throw an IOException
or return null.
- Throws:
IOException
loadCompatibleImage
@Deprecated
public static BufferedImage loadCompatibleImage(InputStream in)
throws IOException
- Deprecated. Use
GraphicsUtilities.loadCompatibleImage(InputStream)
instead
- Throws:
IOException
toCompatibleImage
@Deprecated
public static BufferedImage toCompatibleImage(BufferedImage image)
- Deprecated. (pre-0.9.6) use
GraphicsUtilities.toCompatibleImage(BufferedImage)
setMergedClip
@Deprecated
public static Shape setMergedClip(Graphics g,
Shape newClip)
- Deprecated. (pre-0.9.6) Use
GraphicsUtilities.mergeClip(Graphics,Shape)
instead
- Sets the clip on a graphics object by merging with the existing
clip instead of replacing it. The new clip will be an intersection of
the old clip and the passed in clip shape. The old clip shape will
be returned
resizeGradient
public static Paint resizeGradient(Paint p,
int width,
int height)
- Resizes a gradient to fill the width and height available. If the
gradient is left to right it will be resized to fill the entire width.
If the gradient is top to bottom it will be resized to fill the entire
height. If the gradient is on an angle it will be resized to go from
one corner to the other of the rectangle formed by (0,0 -> width,height).
This method can resize java.awt.GradientPaint, java.awt.LinearGradientPaint,
and the LinearGradientPaint implementation from Apache's Batik project. Note,
this method does not require the MultipleGradientPaint.jar from Apache to
compile or to run. MultipleGradientPaint.jar *is* required if you want
to resize the LinearGradientPaint from that jar.
Any paint passed into this method which is not a kind of gradient paint (like
a Color or TexturePaint) will be returned unmodified. It will not throw
an exception. If the gradient cannot be resized due to other errors the
original paint will be returned unmodified. It will not throw an
exception.