Package com.ms.ui |
![]() Previous |
![]() Contents |
![]() Index |
![]() Next |
public class UIItem extends UIStatic { // Fields public static final int ONLEFT; public static final int ABOVE; public static final int FIRSTLINE; // Constructors public UIItem(); public UIItem(Image image, String text); public UIItem(Image image, String text, int justify); public UIItem(Image image, String text, int justify, int imagePos); // Methods public int getGap(); public Image getImage(); public int getImagePos(); public String getName(); public int getRoleCode(); public void setGap(int gap); public void setImage(Image image); public void setImagePos(int imagePos); public void setName(String text); public void setFocus(boolean on); public void setHot(boolean on); public void setSelected(boolean on); public Dimension minimumSize(); public boolean imageUpdate(Image image, int flags, int x, int y, int width, int height); public void initGraphics(); public void paint(Graphics g, Rectangle rect); }
A class that manages an item static control object; used to display both graphical and text information.
public UIItem();Creates a static item control with no image or text.
public UIItem(Image image, String text);Creates a static item control containing the specified image and text; sets the justification to centered and its image position to ONLEFT.
Parameter Description image The image to be displayed. text The text to be displayed.
public UIItem(Image image, String text, int justify);Creates a static item control containing the specified image and text with the specified justification; sets its image position to ONLEFT.
Parameter Description image The image to be displayed. text The text to be displayed. justify The justification used when arranging content within control.
public UIItem(Image image, String text, int justify, int imagePos);Creates a static item control containing the specified image and text with the specified justification and with a specified image position.
Parameter Description image The image to be displayed. text The text to be displayed. justify The justification used when arranging content within the control. imagepos The position of image relative to text.
public int getGap();Retrieves the size of the gap between the image and text in the control.
Return Value:
Returns the number of pixels in the gap.
Remarks:
If the image is positioned above the text, this gap is the vertical space between the image and text. Otherwise, the gap is the horizontal space between the two.
public Image getImage();Retrieves the image that is displayed by the control.
Return Value:
Returns an Image object containing the control's image.
public int getImagePos();Retrieves the image position within the control relative to the text.
Return Value:
Returns the image position, which can be ONLEFT, ABOVE, or FIRSTLINE.
public String getName();Retrieves the text that is displayed by the control.
Return Value:
Returns a String object containing the item's text.
public int getRoleCode();Retrieves the role of the control.
Return Value:
Returns the ROLE_SYSTEM code that best describes the role of the control.
Remarks:
This method returns the ROLE_SYSTEM_GRAPHIC code.
public boolean imageUpdate(Image image, int flags, int x, int y, int width, int height);Updates the image displayed by the control.
Return Value:
Returns false if the image passed is not the image displayed by the control.
Parameter Description image The image displayed by the control. flags Flags that specify information about the image update. You can pass any bitwise combination of the fields defined in the ImageObserver interface. x The x coordinate for the clipping rectangle used by this graphics context. y The y coordinate for the clipping rectange used by this graphics context. width The width of the clipping rectangle. height The height of the clipping rectangle.
public void initGraphics();Initializes the graphics when the graphics context is initially made available.
Return Value:
No return value.
Remarks:
This method is used instead of the constructor to do an initialization that requires the graphics context. In this case, it computes the size of the item.
public Dimension minimumSize();Determines the minimum size of the control. The minimum size specifies the smallest dimensions (in pixels) that will allow the control's content to be displayed.
Return Value:
Returns a Dimension object containing the minimum size.
public void paint(Graphics g, Rectangle rect);Repaints the image control within the specified rectangle.
Return Value:
No return value.
Parameter Description g The graphics context. rect The rectangle to paint the graphics in. Overrides:
Overrides paint in class UIStatic.
public void setFocus(boolean on);Sets the focus state of this object.
Return Value:
No return value.
Parameter Description on Set to true to enable the state; set to false to disable this state. Remarks:
This method forces a repaint if the control contains text.
Overrides:
Overrides setFocus in class UICanvas.
public void setGap(int gap);Sets the size of the gap between the image and text in the control.
Return Value:
No return value.
Parameter Description gap The size of gap between image and text (in pixels). Remarks:
If the image is positioned above the text, this gap is the vertical space between the image and text. Otherwise, the gap is the horizontal space between the two.
public void setHot(boolean on);Sets the hot-track state of this object.
Return Value:
No return value.
Parameter Description on Set to true to enable the state; set to false to disable this state. Remarks:
This method forces a repaint if the control contains text.
Overrides:
Overrides setHot in class UICanvas.
public void setImage(Image image);Sets the image that is displayed by the control.
Return Value:
No return value.
Parameter Description image The image to be displayed.
public void setImagePos(int imagePos);Sets the image position within the control relative to the text.
Return Value:
No return value.
Parameter Description imagePos The image position relative to the text. You can specify ONLEFT, ABOVE, or FIRSTLINE. Remarks:
An IllegalArgumentException is thrown if an invalid position is specified.
public void setName(String text);Sets the text that is displayed by the control.
Return Value:
No return value.
Parameter Description text The text that is displayed by the control.
public void setSelected(boolean on);Sets the selected state of this object.
Return Value:
No return value.
Parameter Description on Set to true to enable the state; set to false to disable this state. Remarks:
This method forces a repaint if the control contains text.
Overrides:
Overrides setSelected in class UICanvas.
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.