Package com.ms.ui |
![]() Previous |
![]() Contents |
![]() Index |
![]() Next |
public class UIDrawText extends UICanvas implements IFxTextConstants { // Constructors public UIDrawText(); public UIDrawText(String newBuff); public UIDrawText(char newBuff[]); // Methods public void createCaret(); public void destroyCaret(); public void hideCaret(); public void moveCaret(int idx); public void showCaret(); public void showCaret(int iPos); protected int eoln(int idx); public int length(); public void selectAll(); public boolean isAutoResizable(); public boolean isBordered(); public boolean isSingleLine(); public Graphics getCachedGraphics(); public int getCharFromScreen(int scrnX, int scrnY); public int getCharFromScreen(Point scrnPos); public Point getCharLocation(int iPos); public int getCurrIndex(); public IFxShape getOutline(); public char getPasswordChar(); public String getSelectedText(); public int getSelectionEnd(); public int getSelectionStart(); public Point getStartPoint(); public String getText(); protected int getWordEdge(int iPos, boolean pleaseMoveLeft, boolean givePrevious); public int getWordWrap(); public void setAutoResize(boolean auto); public void setBackground(Color c); public void setBorder(boolean b); public void setCurrIndex(int idx, boolean showCaretNow); public void setFont(Font f); public void setFont(Font f, int min, int max); public void setForeground(Color c); public void setHorizAlign(int h); public void setOutline(IFxShape outline); public void setPasswordChar(char c); public void setRefresh(boolean r); public void setSelection(int selStart, int selEnd); public void setSingleLine(boolean sl); public void setText(String s); public void setText(char newBuff[], int offset, int len); public void setVertAlign(int v); public void setWordWrap(int ww); public void ensureNotDirty(FxGraphics g); public boolean ensureVisible(int idx); public boolean ensureVisible(Point p); public boolean ensureVisible(Rectangle r); public Dimension minimumSize(); public Dimension preferredSize(); public void paint(Graphics g); protected void paint(FxGraphics g, int startPos, int endPos); public void reshape(int x, int y, int width, int height); public void resize(int width, int height); public boolean gotFocus(Event evt, Object what); public boolean lostFocus(Event evt, Object what); public boolean keyDown(Event evt, int key); public boolean mouseDown(Event evt, int x, int y); public boolean mouseDrag(Event evt, int x, int y); }
A class that manages the display of read-only text. Although the text cannot be changed through user interaction, it can be changed programmatically. Use UIEdit to allow the user to edit the control.
public UIDrawText();Creates an empty read-only text control.
public UIDrawText(String newBuff);Creates a read-only text control based on the specified string.
Parameter Description newBuff The text for the control.
public UIDrawText(char newBuff[]);Creates a read-only text control based on the specified char buffer.
Parameter Description newBuff Contains the text for the control.
public void createCaret();Creates a caret for the control and displays it at the current position.
Return Value:
No return value.
public void destroyCaret();Destroys the caret.
Return Value:
No return value.
public void ensureNotDirty(FxGraphics g);Updates all text blocks.
Return Value:
No return value.
Parameter Description g A Graphics object to which the control will paint itself.
public boolean ensureVisible(int idx);Ensures that a character index is visible and scrolls the control, if necessary.
Return Value:
Returns true if the method was successful or false otherwise.
Parameter Description idx Index of the character that will be made visible.
public boolean ensureVisible(Point p);Ensures that a position in the control is visible and scrolls the control, if necessary.
Return Value:
Returns true if the method was successful or false otherwise.
Parameter Description p Client coordinates that will be made visible.
public boolean ensureVisible(Rectangle r);Ensures that a specified rectangle is visible and resizes the control, if necessary.
Return Value:
Returns true if the method was successful or false otherwise.
Parameter Description r A Rectangle object that contains the desired rectangle.
protected int eoln(int idx);Retrieves the end of line character index for a line.
Return Value:
Returns the character index of the end of line. This is where the caret would be placed if it were at the end of the line.
Parameter Description idx Index of a character on the line in question.
public Graphics getCachedGraphics();Retrieves the Graphics object for the control.
Return Value:
Returns the control's Graphics object.
public int getCharFromScreen(int scrnX, int scrnY);Retrieves the character at the specified position.
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.
Parameter Description scrnX Specifies the x client coordinate, in pixels. scrnY Specifies the y client coordinate, in pixels.
public int getCharFromScreen(Point scrnPos);Retrieves the character at the specified position.
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.
Parameter Description scrnPos Specifies the client coordinates, in pixels.
public Point getCharLocation(int iPos);Retrieves the position that the character would be drawn at if drawn alone. This is typically used for placing the caret.
Return Value:
A point.
Return Value:
Returns a Point that contains the client coordinates of the character.
Parameter Description iPos Index of the character to query.
public int getCurrIndex();Retrieves the current caret position.
Return Value:
Returns the character index where the caret is located.
public IFxShape getOutline();Retrieves the outline of the control.
Return Value:
Returns an IFxShape object that specifies the outline.
public char getPasswordChar();Retrieves the character that the control displays for password characters.
Return Value:
Returns the character that the control displays for password characters.
public String getSelectedText();Retrieves the selected text in the control.
Return Value:
Returns a String object that contains the selected text of the control.
public int getSelectionEnd();Retrieves the ending point of the selection.
Return Value:
Returns the character index of the ending point of the selection.
public int getSelectionStart();Retrieves the starting point of the selection.
Return Value:
Returns the character index of the starting point of the selection.
public Point getStartPoint();Retrieves the drawing start point of the control.
Return Value:
A Point object that specifies the drawing start point of the control.
public String getText();Retrieves the text in the control.
Return Value:
Returns a String object that contains the text of the control.
protected int getWordEdge(int iPos, boolean pleaseMoveLeft, boolean givePrevious);Searches for and retrieves the character index of the first or last character in a word.
Return Value:
Returns the index of the first or the last character of the word, depending upon givePrevious.
Parameter Description iPos Specifies the position where the search should start. pleaseMoveLeft Specifies the direction of the search. If true, the search will be to the left of iPos. If false, the search will be to the right of iPos. givePrevious Specifies if the index of the beginning or end of the word will be returned. If true, the index of the first character will be returned. If false, the index of the last character will be returned.
public int getWordWrap();Retrieves the word wrapping style.
Return Value:
Returns the word wrapping style. This is a combination of one or more of the ww values of the IFxTextConstants.
public boolean gotFocus(Event evt, Object what);Called when the component receives the input focus.
Parameter Description evt An Event object that specifies the event. what The Object that previously had the focus.
public void hideCaret();Hides the caret.
Return Value:
No return value.
public boolean isAutoResizable();Retrieves the control's auto resize attribute.
Return Value:
Returns true if the control is auto re-sizable or false otherwise.
public boolean isBordered();Retrieves the control's border attribute.
Return Value:
Returns true if the control is bordered or false if the control is not bordered.
public boolean isSingleLine();Retrieves the control's multi-line attribute.
Return Value:
Returns true if the control is multi-line or false if the control is single-line.
public boolean keyDown(Event evt, int key);Processes a key down event.
Return Value:
Returns true if the event was handled by the method; otherwise, returns false.
Parameter Description evt An Event object that specifies the event. key Specifies the key that the event occurred for.
public int length();Retrieves the length of the text in the control.
Return Value:
Returns the number of characters in the control.
public boolean lostFocus(Event evt, Object what);Called when the component loses the input focus.
Parameter Description evt An Event object that specifies the event. what The Object that is gaining the focus.
public Dimension minimumSize();Retrieves the minimum size of the control.
Return Value:
Returns a Dimension object that contains the minimum size of the control.
See Also: preferredSize, LayoutManager
public boolean mouseDown(Event evt, int x, int y);Processes a mouse down event.
Return Value:
Returns true if the event was handled by the method or false otherwise.
Parameter Description evt An Event object that specifies the . x Specifies the x coordinate where the mouse event occurred. y Specifies the y coordinate where the mouse event occurred.
public boolean mouseDrag(Event evt, int x, int y);Processes a mouse drag event.
Return Value:
Returns true if the event was handled by the method or false otherwise.
Parameter Description evt An Event object that specifies the event. x Specifies the x coordinate where the mouse event occurred. y Specifies the y coordinate where the mouse event occurred.
public void moveCaret(int idx);Positions the caret at the specified character index.
Return Value:
No return value.
Parameter Description idx Character index where the caret should be placed.
public void paint(Graphics g);Causes the control to paint itself.
Return Value:
No return value.
Parameter Description g A Graphics object to which the control will paint itself.
protected void paint(FxGraphics g, int startPos, int endPos);Causes the control to paint a portion of text.
Return Value:
No return value.
Parameter Description g A Graphics object to which the control will paint itself. startPos Specifies the starting character index. endPos Specifies the ending character index.
public Dimension preferredSize();Retrieves the preferred size of the control.
Return Value:
Returns a Dimension object that contains the preferred size of the control.
See Also: minimumSize, LayoutManager
public void reshape(int x, int y, int width, int height);Moves and sizes the control.
Return Value:
No return value.
Parameter Description x Specifies the horizontal position of the control, in pixels, relative to its parent. y Specifies the vertical position of the control, in pixels, relative to its parent. width Specifies the width of the control, in pixels. height Specifies the height of the control, in pixels.
public void resize(int width, int height);Sizes the control, but does not move it.
Return Value:
No return value.
Parameter Description width Specifies the width of the control, in pixels. height Specifies the height of the control, in pixels.
public void selectAll();Selects all of the text in the control.
Return Value:
No return value.
public void setAutoResize(boolean auto);Sets the control's auto resize attribute.
Return Value:
No return value.
Parameter Description auto True if the control's bounding box will adjust to the size of the control if it is resized or reshaped or false otherwise.
public void setBackground(Color c);Sets the background color of the control.
Return Value:
No return value.
Parameter Description c A Color object that specifies the background color.
public void setBorder(boolean b);Sets the control's border attribute.
Return Value:
No return value.
Parameter Description b True if the control becomes bordered or false if the control becomes not bordered.
public void setCurrIndex(int idx, boolean showCaretNow);Sets the current caret position and, optionally, shows it.
Return Value:
No return value.
Parameter Description idx Character index where the caret should be placed. showCaretNow True if the caret should be shown or false if the caret should remain in its current display state.
public void setFont(Font f);Sets the font for the current selection. If no selection is present, sets the font for all of the text.
Return Value:
No return value.
Parameter Description f A Font object that specifies the font.
public void setFont(Font f, int min, int max);Sets the font for a block of text.
Return Value:
No return value.
Parameter Description f A Font object that specifies the font for the block. min Specifies the starting index of the block. This must be greater than or equal to max. max Specifies the ending index of the block. This must be less than or equal to min.
public void setForeground(Color c);Sets the text color of the control.
Return Value:
No return value.
Parameter Description c A Color object that specifies the text color.
public void setHorizAlign(int h);Sets the horizontal alignment.
Return Value:
No return value.
Parameter Description h One of the hta values of the IFxTextConstants.
public void setOutline(IFxShape outline);Sets the outline of the control.
Return Value:
No return value.
Parameter Description outline An IFxShape object that specifies the outline.
public void setPasswordChar(char c);Sets the character that the control displays for password characters.
Return Value:
No return value.
Parameter Description c Specifies the character that will be displayed in place of password characters. If this value is zero, the password character is cleared.
public void setRefresh(boolean r);Sets the refresh flag.
Return Value:
No return value.
Parameter Description r If true, the control will update itself whenever a parameter is changed. If false, the control will not update itself. Remarks:
Normally, when a parameter is changed an update will take place immediately. If you want to update multiple parameters, set the refresh to false, make all of the changes and then set it back to true.
public void setSelection(int selStart, int selEnd);Sets the current selection to the specified start and end indexes.
Return Value:
No return value.
Parameter Description selStart The starting index of the selection. selEnd The ending index of the selection.
public void setSingleLine(boolean sl);Changes the control's multi-line attribute.
Return Value:
No return value.
Parameter Description sl Specifies if the control is multi-line or not. If true, the control becomes multi-line. If false, the control becomes single-line.
public void setText(String s);Sets the text in the control.
Return Value:
No return value.
Parameter Description s A String object that specifies the new text.
public void setText(char newBuff[], int offset, int len);Replaces the text in the sentence.
Replace the text in the sentence based on an array of characters passed in.
Parameter Description newBuff The array of characters to base the new sentence on. offset The offset to use. length The length of the array used.
public void setVertAlign(int v);Sets the vertical alignment.
Return Value:
No return value.
Parameter Description v One of the vta values of the IFxTextConstants.
public void setWordWrap(int ww);Sets the word wrapping style.
Return Value:
No return value.
Parameter Description ww A combination of one or more of the ww values of the IFxTextConstants.
public void showCaret();Shows the caret at the current position.
Return Value:
No return value.
public void showCaret(int iPos);Positions the caret at the specified position and shows it.
Return Value:
No return value.
Parameter Description iPos Character index where the caret should be placed.
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.