Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.ui   Previous This
Package
Next

 


Class AwtUIDrawText

public class AwtUIDrawText extends AwtUIControl
{
  // Constructors
  public AwtUIDrawText();
  public AwtUIDrawText(String newBuff);
  public AwtUIDrawText(char newBuff[]);

  // Methods
  public IUIComponent getBase();
  public int getCharFromScreen(int scrnX, int scrnY);
  public int getCharFromScreen(Point scrnPos);
  public Point getCharLocation(int iPos);
  public int getLength();
  public IFxShape getOutline();
  public String getValueText();
  public int getWordWrap();
  public boolean isAutoResizable();
  public boolean isBordered();
  public boolean isSingleLine();
  public void setAutoResizable(boolean auto);
  public void setBordered(boolean b);
  public void setHorizAlign(int h);
  public void setOutline(IFxShape outline);
  public void setRefresh(boolean r);
  public void setSingleLine(boolean sl);
  public void setValueText(String s);
  public void setValueText(char newBuff[], int offset, int len);
  public void setVertAlign(int v);
  public void setWordWrap(int ww);
}

This class implements the functionality of a UIDrawText object in an AWT-based control. An AwtUIDrawText control is an AwtUIHost component whose associated root container holds a UIDrawText object. By hosting this object, an AwtUIDrawText control integrates AFC with AWT. Although an AwtUIDrawText control is fully compatible with AWT, a UIDrawText control is optimized for performance and size.

Panel
  |
  +--AwtUIHost
    |
    +--AwtUIControl
      |
      +--AwtUIDrawText

Constructors

AwtUIDrawText

public AwtUIDrawText();

Creates an empty, read-only AWT-based text control.

AwtUIDrawText

public AwtUIDrawText(String newBuff);

Creates a read-only AWT-based text control with the specified string.

ParameterDescription
newBuff The text for the control.

AwtUIDrawText

public AwtUIDrawText(char newBuff[]);

Creates a read-only AWT-based text control with the specified character buffer.

ParameterDescription
newBuff Contains the text for the control.

Methods

getBase

public IUIComponent getBase();

Retrieves the UI component that the control is based on.

Return Value:

Returns the UIDrawText object associated with the control.

Remarks:

When the AWT-based control is first created, it is associated with a UIDrawText object.

getCharFromScreen

public int getCharFromScreen(int scrnX, int scrnY);

Retrieves the character at the specified coordinates.

Return Value:

Returns the index of the character at the specified position. If there is no character at that position, the character returned will be the last one on the nearest line.

ParameterDescription
scrnX The x coordinate, in pixels.
scrnY The y coordinate, in pixels.

getCharFromScreen

public int getCharFromScreen(Point scrnPos);

Retrieves the character at the specified point.

Return Value:

Returns the index of the character at the specified position. If there is no character at that position, the character returned will be the last one on the nearest line.

ParameterDescription
scrnPos The coordinates of the point, in pixels.

getCharLocation

public Point getCharLocation(int iPos);

Retrieves the position that the character would be drawn at if drawn alone. Typically, this is used for placing the caret.

Return Value:

Returns a Point object that contains the client coordinates of the character.

ParameterDescription
iPos The index of the character to query.

getLength

public int getLength();

Retrieves the length of the text in the control.

Return Value:

Returns the number of characters in the control.

getOutline

public IFxShape getOutline();

Retrieves the outline along which text is drawn. For example, if the outline is an ellipse, the text that the AwtUIDrawText object is created with is drawn along the outline of the ellipse.

Return Value:

Returns an IFxShape object that specifies the outline.

See Also: setOutline

getValueText

public String getValueText();

Retrieves the text in the control.

Return Value:

Returns a String object that contains the text of the control.

See Also: setValueText

getWordWrap

public int getWordWrap();

Retrieves the word wrapping style.

Return Value:

Returns the word wrapping style. For a list of possible values, see setWordWrap.

isAutoResizable

public boolean isAutoResizable();

Determines whether the bounding box of the control's text will automatically adjust to the size of the control when the control is resized or reshaped.

Return Value:

Returns true if the auto-resize attribute is set; otherwise, returns false.

See Also: setAutoResizable

isBordered

public boolean isBordered();

Determines whether the control has a border.

Return Value:

Returns true if the control has a border; otherwise, returns false.

See Also: setBordered

isSingleLine

public boolean isSingleLine();

Retrieves the control's single line attribute.

Return Value:

Returns false if the control's text can be displayed on multiple lines; otherwise, returns true.

setAutoResizable

public void setAutoResizable(boolean auto);

Sets the control's auto-resize attribute.

Return Value:

No return value.

ParameterDescription
auto If true, the bounding box of the control's text will automatically adjust to the size of the control when the control is resized or reshaped.

See Also: isAutoResizable

setBordered

public void setBordered(boolean b);

Sets or clears the control's border. The border is a rectangle with sides that are one pixel wide and the same color as the text.

Return Value:

No return value.

ParameterDescription
b If true, the control has a border; otherwise, it does not.

See Also: isBordered

setHorizAlign

public void setHorizAlign(int h);

Sets the horizontal alignment of the control's text.

Return Value:

No return value.

ParameterDescription
h The horizontal alignment. You can pass one of the following values, defined by the IFxTextConstants interface.

setOutline

public void setOutline(IFxShape outline);

Sets an outline that the text buffer is drawn along.

Return Value:

No return value.

ParameterDescription
outline An IFxShape object that specifies the outline.

See Also: getOutline

setRefresh

public void setRefresh(boolean r);

Sets the refresh flag. Use this method to prevent unnecessary repaints when setting attributes for a control.

Return Value:

No return value.

ParameterDescription
r If true, the control will update itself whenever a parameter is changed. If false, the control will not update itself.

Remarks:

Using this method only prevents painting when APIs that change the control directly are called (for example, if you call several methods in sequence, such as setForeground, setBackground, and setWordWrap). It does not prevent painting on normal system updates.

setSingleLine

public void setSingleLine(boolean sl);

Changes the control's single line attribute.

Return Value:

No return value.

ParameterDescription
sl Set to false if the control's text is displayed on multiple lines. Otherwise, the text is displayed on a single line.

setValueText

public void setValueText(String s);

Sets the text in the control.

Return Value:

No return value.

ParameterDescription
s A String object that specifies the new text.

See Also: getValueText

setValueText

public void setValueText(char newBuff[], int offset, int len);

Sets the text in the control.

Return Value:

No return value.

ParameterDescription
newBuff The array of characters that contains the text.
offset The offset of the newBuff text buffer where the text starts.
len The length of the text.

See Also: getValueText

setVertAlign

public void setVertAlign(int v);

Sets the vertical alignment of the control's text.

Return Value:

No return value.

ParameterDescription
v The vertical alignment. You can pass one of the following values, defined by the IFxTextConstants interface.

setWordWrap

public void setWordWrap(int ww);

Sets the word wrapping style.

Return Value:

No return value.

ParameterDescription
ww The style of word wrapping. You can pass one of the following values, defined by the IFxTextConstants interface.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.