public abstract class ImageFactory extends Object
There is a default static image factory that can be assigned by calling:
ImageFactory.setImageFactory(null, new ImageFactory() {
public Image createImage(int w, int h, int bgColor) {
// create an image
// The Default would be just to call
return Image.createImage(w, h, bgColor);
}
});
You can also assign a factory whose scope is limited to a particular Form, Container,
or Component, by setting the context argument in setImageFactory()
.
Constructor and Description |
---|
ImageFactory() |
Modifier and Type | Method and Description |
---|---|
static Image |
createImage(Component context,
int w,
int h,
int bgColor)
Creates an image using the factory at a given context.
|
abstract Image |
createImage(int w,
int h,
int bgColor) |
static ImageFactory |
getImageFactory(Component cmp)
Gets the image factory for a given component.
|
static ImageFactory |
setImageFactory(Component cmp,
ImageFactory f)
Sets the ImageFactory for the given component.
|
public abstract Image createImage(int w, int h, int bgColor)
public static ImageFactory getImageFactory(Component cmp)
If none of the component's descendants have an ImageFactory, then it will use the default global ImageFactory.
cmp
- The context from which to load the image factory. Use null to get the global
default factory.public static ImageFactory setImageFactory(Component cmp, ImageFactory f)
cmp
- The component to set the ImageFactory for. If this parameter is null, then
this method will set the default global ImageFactoryf
- The ImageFactory to assign to the component.public static Image createImage(Component context, int w, int h, int bgColor)
context
- The context where the ImageFactory should be loaded from.w
- The width of the image to create.h
- The height of the image to create.bgColor
- The background color of the image.