Package org.compiere.plaf
Class CompiereUtils
- java.lang.Object
-
- org.compiere.plaf.CompiereUtils
-
public class CompiereUtils extends Object
UI utilities- Version:
- $Id: AdempiereUtils.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $
- Author:
- Jorg Janke
-
-
Field Summary
Fields Modifier and Type Field Description static Color
COL_1END
End Top Color - white 0static Color
COL_1TOP
Top Top Color - white 128 the higher the ligherstatic Color
COL_2END
End End Color - black 64 the higher the darkerstatic Color
COL_2TOP
Top End Color - black 0protected static Component
s_component
Component for media trackerprotected static MediaTracker
s_tracker
Media tracker
-
Constructor Summary
Constructors Constructor Description CompiereUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 colorsstatic 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, Rectangle r, boolean round, boolean out)
Paint 3D effect in (lighten in upper half, darken in lowerhalf) (called from paint methods)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
setNotBuffered(Component c)
Set Not Buffered.
-
-
-
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
-
-
Method Detail
-
fillRectange
public static void fillRectange(Graphics2D g2D, JComponent c, boolean round)
Fill Background with Color. (Ususlly called from update methods)- Parameters:
g2D
- Graphicsc
- Componentround
- 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
- Graphicsr
- Ractangleround
- paint round cornersout
- 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
- Graphicsc
- Componentround
- paint round cornersout
- paint sticking out (not pressed)
-
getTranslucentColor
public static Color getTranslucentColor(Color c, int alpha)
Helper to simplify creation of translucent colors- Parameters:
c
- Coloralpha
- 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:
File.toURI()
,URI.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:
File.toURI()
-
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
,File.toURI()
,URI.toURL()
-
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
-
-