Package com.ms.ui |
![]() Previous |
![]() Contents |
![]() Index |
![]() Next |
public abstract class UIStatic extends UICanvas { // Fields public static final int LEFT; public static final int RIGHT; public static final int TOP; public static final int BOTTOM; public static final int HCENTER; public static final int VCENTER; public static final int CENTERED; public static final int TOPLEFT; public static final int TOPRIGHT; public static final int BOTTOMLEFT; public static final int BOTTOMRIGHT; public static final int NOEDGE; public static final int HOTTRACK; // Constructors public UIStatic(); public UIStatic(int style); // Methods public Dimension calcString(String text); public Dimension calcString(Graphics g, String text); public void drawString(Graphics g, String text, Rectangle rect); public Dimension getContent(); public Rectangle getContentBounds(); public void setContent(int width, int height); public void setContent(Dimension content); public void setFlags(int style); public void setHot(boolean on); public Dimension minimumSize(); public Dimension preferredSize(); public void paint(Graphics g); public void paint(Graphics g, Rectangle rect); }
An abstract class that manages a static control object. Controls of this type display information, and are often used as building blocks for other controls such as buttons, list boxes, and menus.
public UIStatic();Creates a static control with a style of CENTERED.
public UIStatic(int style);Creates a static control with the specified style.
Parameter Description style The style of the control. Specify one of the UIStatic fields.
public Dimension calcString(String text);Calculates the dimensions of the bounding rectangle for the given string, based on the font metrics of the static control's graphics context.
Return Value:
Returns the dimensions of the text string.
Parameter Description text The text string.
public Dimension calcString(Graphics g, String text);Calculates the dimensions of the rectangle for the given string, based on the font metrics of the specified graphics context.
Return Value:
Returns the dimensions of the text string.
Parameter Description g The graphics context. If null, this method assumes the graphics context of the static control. text The text string.
public void drawString(Graphics g, String text, Rectangle rect);Draws the specified text in a rectangle using the specified graphics context.
Return Value:
No return value.
Parameter Description g The graphics context to paint the text in. text The text to be painted. rect The rectangle to paint the text in.
public Dimension getContent();Retrieves the current dimensions of this control's contents.
Return Value:
Returns null if no content dimensions have been provided; otherwise, returns the dimensions of the content.
public Rectangle getContentBounds();Retrieves the dimensions of the contents to paint.
Return Value:
Returns a Rectangle that defines the size of the content area.
public Dimension minimumSize();Retrieves the minimum size of the static control.
Return Value:
Returns the minimum size.
public void paint(Graphics g);Draws the static control.
Return Value:
No return value.
Parameter Description g The graphics context.
public void paint(Graphics g, Rectangle rect);Draws the static control within the specified rectangle.
Return Value:
No return value.
Parameter Description g The graphics context. rect The rectangle in which to paint the control. Remarks:
This method is currently not implemented here, however it is used in UIText.
public Dimension preferredSize();Determines the preferred size of the static control.
Return Value:
Returns the preferred size.
Remarks:
The preferredSize is the width and height specified by the most recent call to the reshape or resize method.
public void setContent(int width, int height);Sets the current dimensions of the control's contents, based on the specified values.
Return Value:
No return value.
Parameter Description width The width of the control's contents. height The height of the control's contents.
public void setContent(Dimension content);Sets the current dimensions of the control's contents, based on the specified Dimension object.
Return Value:
No return value.
Parameter Description content A Dimension object containing the dimensions for the control.
public void setFlags(int style);Sets the style of the static control.
Return Value:
No return value.
Parameter Description style The style of the control. Specify one of the UIStatic fields. Remarks:
One vertical justification style and one horizontal justification style can be specified. If no vertical justification is specified, VCENTER is used by default. If no horizontal justification is specified, HCENTER is used by default. If more than one vertical justification or more than one horizontal justification is specifed, an IllegalArgumentException is thrown. The same exception is also thrown if an invalid bit is set.
public void setHot(boolean on);Sets the hot-tracked state of the static control.
Return Value:
No return value.
Parameter Description on If true, the hot-tracked state is set; otherwise, it is cleared. Remarks:
When the user moves the mouse over the control, hot-tracking indicates that the control will receive focus if selected.
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.