Compiere Looks 1.2.1

org.compiere.plaf
Class CompiereUtils

java.lang.Object
  |
  +--org.compiere.plaf.CompiereUtils

public class CompiereUtils
extends Object

UI utilities

Version:
$Id: CompiereUtils.java,v 1.7 2002/07/08 04:03:37 jjanke Exp $
Author:
Jorg Janke

Field Summary
static Color COL_1END
          End Top Color - white 0
static Color COL_1TOP
          Top Top Color - white 128 the higher the ligher
static Color COL_2END
          End End Color - black 64 the higher the darker
static Color COL_2TOP
          Top End Color - black 0
protected static Component s_component
          Component for media tracker
protected static MediaTracker s_tracker
          Media tracker
 
Constructor Summary
CompiereUtils()
           
 
Method Summary
static void fillRectange(Graphics2D g2D, JComponent c, boolean round)
          Fill Background with Color.
static Color getTranslucentColor(Color c, int alpha)
          Helper to simplify creation of translucent colors
static boolean isLeftToRight(Component c)
          Convenience function for determining ComponentOrientation.
static BufferedImage loadBufferedImage(File file, int imageType)
          Load an image from a given file into a BufferedImage.
static BufferedImage loadBufferedImage(String path, int imageType)
          Load an image from a given path into a BufferedImage.
static BufferedImage loadBufferedImage(URL url, int imageType)
          Loads an image from a given URL into a BufferedImage.
static BufferedImage loadBufferedJPEGImage(URL url)
          Load a JPEG image from a given location.
static Image loadImage(String path)
          load the image located at path.
static Image loadImage(URL url)
          Load the image located at URL.
static void paint3Deffect(Graphics2D g2D, JComponent c, boolean round, boolean out)
          Paint 3D effect in (lighten in upper half, darken in lowerhalf) (called from paint methods)
static void paint3Deffect(Graphics2D g2D, Rectangle r, boolean round, boolean out)
          Paint 3D effect in (lighten in upper half, darken in lowerhalf) (called from paint methods)
static void setNotBuffered(Component c)
          Set Not Buffered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COL_1TOP

public static final Color COL_1TOP
Top Top Color - white 128 the higher the ligher


COL_1END

public static final Color COL_1END
End Top Color - white 0


COL_2TOP

public static final Color COL_2TOP
Top End Color - black 0


COL_2END

public static final Color COL_2END
End End Color - black 64 the higher the darker


s_component

protected static final Component s_component
Component for media tracker


s_tracker

protected static final MediaTracker s_tracker
Media tracker

Constructor Detail

CompiereUtils

public CompiereUtils()
Method Detail

fillRectange

public static void fillRectange(Graphics2D g2D,
                                JComponent c,
                                boolean round)
Fill Background with Color. (Ususlly called from update methods)

Parameters:
g2D - Graphics
c - Component
round - paint round corners

paint3Deffect

public static void paint3Deffect(Graphics2D g2D,
                                 Rectangle r,
                                 boolean round,
                                 boolean out)
Paint 3D effect in (lighten in upper half, darken in lowerhalf) (called from paint methods)

Parameters:
g2D - Graphics
round - paint round corners
out - paint sticking out (not pressed)

paint3Deffect

public static void paint3Deffect(Graphics2D g2D,
                                 JComponent c,
                                 boolean round,
                                 boolean out)
Paint 3D effect in (lighten in upper half, darken in lowerhalf) (called from paint methods)

Parameters:
g2D - Graphics
c - Component
round - paint round corners
out - paint sticking out (not pressed)

getTranslucentColor

public static Color getTranslucentColor(Color c,
                                        int alpha)
Helper to simplify creation of translucent colors

Parameters:
c - Color
alpha -
Returns:
Translucent Color

setNotBuffered

public static void setNotBuffered(Component c)
Set Not Buffered. Recursive for all contained components

Parameters:
c -

loadImage

public static Image loadImage(String path)
load the image located at path.

Parameters:
path - location of image file in local file system - otherwise relative to class
Returns:
loaded image at path or url
See Also:
#java.io.File.toUrl

loadImage

public static Image loadImage(URL url)
Load the image located at URL.

Parameters:
url - URL where the image file is located.
Returns:
loaded image at path or url
See Also:
#java.io.File.toUrl

loadBufferedImage

public static BufferedImage loadBufferedImage(File file,
                                              int imageType)
Load an image from a given file into a BufferedImage. The image is returned in the format defined by the imageType parameter. Note that this is special cased for JPEG images where loading is performed outside the standard media tracker, for efficiency reasons.

Parameters:
file - File where the image file is located.
imageType - one of the image type defined in the BufferedImage class.
Returns:
loaded image at path or url
See Also:
BufferedImage

loadBufferedImage

public static BufferedImage loadBufferedImage(String path,
                                              int imageType)
Load an image from a given path into a BufferedImage. The image is returned in the format defined by the imageType parameter. Note that this is special cased for JPEG images where loading is performed outside the standard media tracker, for efficiency reasons.

Parameters:
path - Name of file where the image file is located.
imageType - one of the image type defined in the BufferedImage class.
Returns:
loaded image at path or url
See Also:
BufferedImage

loadBufferedImage

public static BufferedImage loadBufferedImage(URL url,
                                              int imageType)
Loads an image from a given URL into a BufferedImage. The image is returned in the format defined by the imageType parameter. Note that this is special cased for JPEG images where loading is performed outside the standard media tracker, for efficiency reasons.

Parameters:
url - URL where the image file is located.
imageType - one of the image type defined in the BufferedImage class.
Returns:
loaded image at path or url
See Also:
BufferedImage

loadBufferedJPEGImage

public static BufferedImage loadBufferedJPEGImage(URL url)
Load a JPEG image from a given location.

Parameters:
url - URL where the image file is located.
Returns:
loaded image at path or url

isLeftToRight

public static boolean isLeftToRight(Component c)
Convenience function for determining ComponentOrientation. Copied from MetalUtils

Parameters:
c - Component
Returns:
true, if left to right

Compiere Looks 1.2.1

Copyright (c) 1999-2003 ComPiere, Inc. - Author: Jorg Janke