Package com.ms.fx |
![]() Previous |
![]() Contents |
![]() Index |
![]() Next |
public class FxText { // Fields public char buffer[]; public int nChars; public int nBuffSize; // Constructors public FxText(); public FxText(String newBuff); public FxText(char newBuff[]); public FxText(char newBuff[], int offset, int length); // Methods public boolean isWhite(int i); public boolean isWhite(int i, boolean treatLFasWhite); public int getWordBreak( int iChar ); public void ensureResize(int amountNeeded); public int length(); public void append(char key); public void append(char key[]); public void append(char key[], int offs, int len); public void setText(char newBuff[]); public void setText(String s); public void setText(char newBuff[], int offset, int nCharsNew); public void insert(char key, int iPos); public void insert(char key[], int offs, int keyLen, int iPos); public void insert(char key[], int iPos); public boolean isDelimiter(int iPos); public void remove(int iPos, int numberToRemove); public char getChar(int idx); }
The FxText class is similar to StringBuffer; however, there is no synchronization on the buffer. This makes it a lot faster. The buffers are designed to be plugged into UI components.
public FxText();Creates an empty sentence.
public FxText(String newBuff);Creates a new sentence based on a string.
Parameter Description newBuff The string to base the new sentence on.
public FxText(char newBuff[]);Creates a new sentence based on a character array.
Parameter Description newBuff The array of characters to base the new sentence on.
public FxText(char newBuff[], int offset, int length);Creates a new sentence based on a portion of a character array.
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 boolean isWhite(int i);Checks if a character is classified as a white space.
Return Value:
Returns true if it is a white space; otherwise, returns false.
Parameter Description i The offset in buffer.
public boolean isWhite(int i, boolean treatLFasWhite);Checks if a character is classified as a white space and whether to include a line feed.
Return Value:
Returns true if it is considered white space; otherwise, returns false.
Parameter Description i The offset in buffer. treatLFasWhite The Boolean value that determines if a line feed should be included. Remarks:
This method is useful for marking the end of a line of text.
public int getWordBreak(int iChar);Retrieves the numbers of characters in the next word.
Return Value:
Returns the number of characters in the next word.
Parameter Description iChar The location to start looking for the next word. Remarks:
The next word includes leading white space, but not trailing.
public void ensureResize(int amountNeeded);Ensures that the buffer has enough room in it.
Return Value:
No return value.
Parameter Description amountNeeded The amount of memory needed for the buffer.
public int length();Retrieves the number of characters in the buffer.
Return Value:
Returns the number of characters in the buffer.
public void append(char key);Appends a character to the end of the buffer.
Return Value:
No return value.
Parameter Description key The character to append.
public void append(char key[]);Appends an array of characters to the end of the buffer.
Return Value:
No return value.
Parameter Description key The array of characters to append.
public void append(char key[], int offs, int len);Appends an array of characters to the end of the buffer, using a specified offset and length.
Return Value:
No return value.
Parameter Description key The array of characters to append. offs The specified offset. len The length of the array.
public void setText(char newBuff[]);Replaces the text in the sentence with that of a character array.
Return Value:
No return value.
Parameter Description newBuff[] A character array.
public void setText(String s);Replaces the text in the sentence with that of a specified string.
Return Value:
No return value.
Parameter Description s The string to replace the sentence.
public void setText(char newBuff[], int offset, int nCharsNew);Replaces the text in the sentence with that of a character array, starting at a specified offset.
Return Value:
No return value.
Parameter Description newBuff[] A character array. offset The specified offset. nCharsNew The number of new characters from the character array.
public void insert(char key, int iPos);Inserts a character into the buffer.
Return Value:
No return value.
Parameter Description key The character to insert. iPos The position in the buffer to insert the character.
public void insert(char key[], int offs, int keyLen, int iPos);Inserts an array of characters into the buffer.
Return Value:
No return value.
Parameter Description key The array of characters to insert. offs The specified offset. keyLen The length of the character array. iPos The position in the buffer to insert the character.
public void insert(char key[], int iPos);Inserts an array of characters into the buffer.
Return Value:
No return value.
Parameter Description key The array of characters to insert. iPos The position in the buffer to insert the characters.
public boolean isDelimiter(int iPos);Checks if the character is a delimiter.
Return Value:
Returns true if it is a delimiter; otherwise, returns false.
Parameter Description iPos The position of the character to check.
public void remove(int iPos, int numberToRemove);Deletes one or more characters.
Return Value:
No return value.
Parameter Description iPos The position to start the deletion. numberToRemove The number of characters to remove.
public char getChar(int idx);Retrieves the character at the given location.
Return Value:
Returns the character at position idx.
Parameter Description idx The location of the character.
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.