|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Class FxComponentImagepublic abstract class FxComponentImage extends FxStateConfigurableUIImage { // Fields public final static int CHECK_BOX; public final static int DOWN_ARROW; public final static int EXPAND_BOX; public final static int LEFT_ARROW; public final static int RADIO_BUTTON; public final static int RIGHT_ARROW; public final static int UP_ARROW; // Constructors public FxComponentImage(int states[]); // Methods public void drawChar(Graphics g, String s, int x, int y, int size); public static FxComponentImage getFactory(int idx); public Image getImage(Dimension size, int state); public Image getImage(Dimension size, IUIComponent comp); public Image getImage(Dimension size, int state, Color backColor, Color foreColor); public int getStateID(int state); public Font getWidgetFont(int c); public static void setFactory(int idx, FxComponentImage factory); } This class is a class factory that provides a set of consistent, cross-platform images that are used by the com.ms.ui classes for Graphical User Interface(GUI) display components. The class provides a consistent set of images, regardless of the underlying platform, but can be configured to the underlying platform (if required). The following example shows how to create an FxComponentImage class factory, and then associate it with a component image. // Create an object that contains images for the various states of a // check box component image. int states[] = { FxStateConfigurableUIImage.CHECKED, FxStateConfigurableUIImage.INDETERMINATE }; FxComponentImage fxci = new FxComponentImage(states); // You must specify what type of component image you want // to create the class factory for, with the setFactory method. fxci.setFactory (FxComponentImage.CHECK_BOX, this); By default, the FxComponentImage class creates seven kinds of image class factories. The following table lists these factory styles.
The FxComponentImage objects provide a set of state-dependant images for each component image, depending on what states the image may have. For example, a LEFT_ARROW component image cannot have an INDETERMINATE state, so an image for this state is not provided in the LEFT_ARROW class factory. You can use the static getFactory method to get the default class factory for an image that the FxComponentImage class provides. You can use the getImage method to retrieve the image for a specified state. The following example shows how to create a default factory for a CHECK_BOX image. FxToolkit.getSystemInterface() ; // Initialize FxToolkit. // Retrieve the default class factory for CHECK_BOX provided by FxComponentImage. FxComponentImage fxi = FxComponent.getFactory(FxComponentImage.CHECK_BOX); // Retrieve the image with dimension 20x20 of a selected check box. Image checkedImg = fxi.getImage(new Dimension(20, 20), FxStateConfigurableUIImage.CHECKED); // This will draw a selected check box at (50,50) with dimension 20x20. g.drawImage( checkedImg, 50, 50, this ); FxStateConfigurableImage | +--FxStateConfigurableUIImage | +--FxComponentImage ConstructorsFxComponentImagepublic FxComponentImage(int states[]); MethodsdrawCharpublic void drawChar(Graphics g, String s, int x, int y, int size); getFactorypublic static FxComponentImage getFactory(int idx); getImagepublic Image getImage(Dimension size, int state); getImagepublic Image getImage(Dimension size, IUIComponent comp); getImagepublic Image getImage(Dimension size, int state, Color backColor, Color foreColor); getStateIDpublic int getStateID(int state); getWidgetFontpublic Font getWidgetFont(int c); setFactorypublic static void setFactory(int idx, FxComponentImage factory); Fields
|
© 1998 Microsoft Corporation. All rights reserved. Terms of use. |