public class SWTResourceManager
extends java.lang.Object
dispose()
method to
release the operating system resources managed by cached objects when those objects and OS
resources are no longer needed (e.g. on application shutdown)
This class may be freely distributed as part of any application or plugin.
Copyright (c) 2003 - 2005, Instantiations, Inc.
All Rights Reserved
Modifier and Type | Field and Description |
---|---|
static int |
BOTTOM_LEFT
Style constant for placing decorator image in bottom left corner of base image.
|
static int |
BOTTOM_RIGHT
Style constant for placing decorator image in bottom right corner of base image.
|
static int |
TOP_LEFT
Style constant for placing decorator image in top left corner of base image.
|
static int |
TOP_RIGHT
Style constant for placing decorator image in top right corner of base image.
|
Constructor and Description |
---|
SWTResourceManager() |
Modifier and Type | Method and Description |
---|---|
static Image |
decorateImage(Image baseImage,
Image decorator)
Returns an image composed of a base image decorated by another image
|
static Image |
decorateImage(Image baseImage,
Image decorator,
int corner)
Returns an image composed of a base image decorated by another image
|
static void |
dispose()
Dispose of cached objects and their underlying OS resources.
|
static void |
disposeColors()
Dispose of all the cached colors
|
static void |
disposeCursors()
Dispose all of the cached cursors
|
static void |
disposeFonts()
Dispose all of the cached fonts
|
static void |
disposeImages()
Dispose all of the cached images
|
static void |
disposeImages(java.lang.String section)
Dispose cached images in specified section
|
static void |
fixCoolBarSize(CoolBar bar)
Fix the layout of the specified CoolBar
|
static Font |
getBoldFont(Font baseFont)
Return a bold version of the give font
|
static Color |
getColor(int systemColorID)
Returns the system color matching the specific ID
|
static Color |
getColor(int r,
int g,
int b)
Returns a color given its red, green and blue component values
|
static Color |
getColor(RGB rgb)
Returns a color given its RGB value
|
static Cursor |
getCursor(int id)
Returns the system cursor matching the specific ID
|
static Font |
getFont(java.lang.String name,
int height,
int style)
Returns a font based on its name, height and style
|
static Font |
getFont(java.lang.String name,
int size,
int style,
boolean strikeout,
boolean underline)
Returns a font based on its name, height and style.
|
static Image |
getImage(java.lang.Class<?> clazz,
java.lang.String path)
Returns an image stored in the file at the specified path relative to the specified class
|
protected static Image |
getImage(java.io.InputStream is)
Returns an image encoded by the specified input stream
|
static Image |
getImage(java.lang.String path)
Returns an image stored in the file at the specified path
|
static Image |
getImage(java.lang.String section,
java.lang.String path)
Returns an image stored in the file at the specified path
|
public static final int TOP_LEFT
public static final int TOP_RIGHT
public static final int BOTTOM_LEFT
public static final int BOTTOM_RIGHT
public static void dispose()
public static Color getColor(int systemColorID)
systemColorID
- int The ID value for the colorpublic static Color getColor(int r, int g, int b)
r
- int The red component of the colorg
- int The green component of the colorb
- int The blue component of the colorpublic static Color getColor(RGB rgb)
rgb
- RGB The RGB value of the colorpublic static void disposeColors()
protected static Image getImage(java.io.InputStream is)
is
- InputStream The input stream encoding the image datapublic static Image getImage(java.lang.String path)
path
- String The path to the image filepublic static Image getImage(java.lang.String section, java.lang.String path)
section
- The section to which belongs specified imagepath
- String The path to the image filepublic static Image getImage(java.lang.Class<?> clazz, java.lang.String path)
clazz
- Class The class relative to which to find the imagepath
- String The path to the image filepublic static Image decorateImage(Image baseImage, Image decorator)
baseImage
- Image The base image that should be decorateddecorator
- Image The image to decorate the base imagepublic static Image decorateImage(Image baseImage, Image decorator, int corner)
baseImage
- Image The base image that should be decorateddecorator
- Image The image to decorate the base imagecorner
- The corner to place decorator imagepublic static void disposeImages()
public static void disposeImages(java.lang.String section)
section
- the section do disposepublic static Font getFont(java.lang.String name, int height, int style)
name
- String The name of the fontheight
- int The height of the fontstyle
- int The style of the fontpublic static Font getFont(java.lang.String name, int size, int style, boolean strikeout, boolean underline)
name
- String The name of the fontsize
- int The size of the fontstyle
- int The style of the fontstrikeout
- boolean The strikeout flag (warning: Windows only)underline
- boolean The underline flag (warning: Windows only)public static Font getBoldFont(Font baseFont)
baseFont
- Font The font for whoch a bold version is desiredpublic static void disposeFonts()
public static void fixCoolBarSize(CoolBar bar)
bar
- CoolBar The CoolBar that shgoud be fixedpublic static Cursor getCursor(int id)
id
- int The ID value for the cursorpublic static void disposeCursors()