swingx
Version 2005-08-19

org.jdesktop.swingx.util
Class PaintUtils

java.lang.Object
  extended by 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)
           
static BufferedImage createCompatibleImage(int width, int height)
           
static BufferedImage createCompatibleImage(int width, int height, int transparency)
           
static Border getDefaultBorder()
           
static Rectangle getTextBounds(Graphics g, JLabel label)
          Returns the bounds that the text of a label will be drawn into.
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 void setBackgroundColor(Container cont, Color color)
          Sets the background color for a containment hierarchy.
static void setFont(Container cont, Font font)
           
static void setForegroundColor(Container cont, Color color)
          Sets the foreground color for a containment hierarchy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDefaultBorder

public static Border getDefaultBorder()

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

public static void setBackgroundColor(Container cont,
                                      Color color)
Sets the background color for a containment hierarchy.


setForegroundColor

public static void setForegroundColor(Container cont,
                                      Color color)
Sets the foreground color for a containment hierarchy.


setFont

public static void setFont(Container cont,
                           Font font)

createCompatibleImage

public static BufferedImage createCompatibleImage(int width,
                                                  int height)
Parameters:
width - the width of the new BufferedImage
height - the height of the new BufferedImage
Returns:
Creates and returns a BufferedImage that is "compatible" with this machines video card and subsystem

createCompatibleImage

public static BufferedImage createCompatibleImage(int width,
                                                  int height,
                                                  int transparency)
Parameters:
width - the width of the new BufferedImage
height - the height of the new BufferedImage
transparency - 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

public static BufferedImage convertToBufferedImage(Image img)

swingx
Version 2005-08-19