Class AwtUIEdit
public class AwtUIEdit extends AwtUIControl
{
// Constructors
public AwtUIEdit();
public AwtUIEdit(String newBuff);
public AwtUIEdit(char newBuff[]);
// Methods
public void addActionListener(ActionListener l);
public void addTextListener(TextListener l);
public int append(char key);
public void clear();
public IUIComponent getBase();
public int getCharFromScreen(int scrnX, int scrnY);
public int getCharFromScreen(Point scrnPos);
public Point getCharLocation(int iPos);
public int getLength();
public int getMaxBufferSize();
public IFxShape getOutline();
public char getPasswordChar();
public String getSelectedText();
public String getText();
public int getWordWrap();
public int insert(char key, int iPos);
public boolean isAutoResizable();
public boolean isBordered();
public boolean isReadOnly();
public boolean isSingleLine();
protected void processActionEvent(ActionEvent e);
protected void processHostEvent(AWTEvent e);
protected void processTextEvent(TextEvent e);
public void remove(int iPos, int numberToRemove);
public synchronized void removeActionListener(ActionListener l);
public synchronized void removeTextListener(TextListener l);
public void selectAll();
public void setAutoResizable(boolean auto);
public void setBordered(boolean b);
public void setHorizAlign(int h);
public void setMaxBufferSize(int newMax);
public void setOutline(IFxShape outline);
public void setPasswordChar(char c);
public void setReadOnly(boolean ro);
public void setRefresh(boolean r);
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 showCaret();
public void showCaret(int iPos);
public boolean tabbable();
}
This class implements the functionality of a UIEdit object in an AWT-based control. An AwtUIEdit control is an AwtUIHost component whose associated root container holds a UIEdit object. By hosting this object, an AwtUIEdit control integrates AFC with AWT. Although an AwtUIEdit control is fully compatible with AWT, a UIEdit control is optimized for performance and size.
Panel
|
+--AwtUIHost
|
+--AwtUIControl
|
+--AwtUIEdit
public AwtUIEdit();
Creates an empty AWT-based edit control.
public AwtUIEdit(String newBuff);
Creates an AWT-based edit control with the specified string.
Parameter | Description |
newBuff
| The text of the control.
|
public AwtUIEdit(char newBuff[]);
Creates an AWT-based edit control with the specified character buffer.
Parameter | Description |
newBuff
| The text of the control.
|
public void addActionListener(ActionListener l);
Adds the specified action listener. The listener receives all action events generated for the control.
Return Value:
No return value.
Parameter | Description |
l
| The action listener to be added.
|
See Also: removeActionListener
public void addTextListener(TextListener l);
Adds the specified text listener. The listener receives all text events generated for the control.
Return Value:
No return value.
Parameter | Description |
l
| The text listener to be added.
|
See Also: removeTextListener
public int append(char key);
Appends a character to the end of the text in the control.
Return Value:
Returns the number of characters added.
Parameter | Description |
key
| The character to be appended.
|
public void clear();
Deletes all the text from the edit control.
Return Value:
No return value.
public IUIComponent getBase();
Retrieves the UI component that the control is based on.
Return Value:
Returns the UIEdit object associated with the control.
Remarks:
When the AWT-based control is first created, it is associated with a UIEdit object.
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.
Parameter | Description |
scrnX
| The x coordinate, in pixels.
|
scrnY
| The y coordinate, in pixels.
|
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.
Parameter | Description |
scrnPos
| The coordinates of the point, 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:
Returns a Point object that contains the client coordinates of the character.
Parameter | Description |
iPos
| The index of the character to query.
|
public int getLength();
Retrieves the length of the text in the control.
Return Value:
Returns the number of characters in the control.
public int getMaxBufferSize();
Retrieves the maximum number of characters that the control can hold.
Return Value:
Returns the maximum number of characters that the control can hold.
public IFxShape getOutline();
Retrieves the outline along which text is drawn. For example, if the outline is an ellipse, the text that the AwtUIEdit 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
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 String getText();
Retrieves the text in the control.
Return Value:
Returns a String object that contains the text of the control.
public int getWordWrap();
Retrieves the word wrap style.
Return Value:
Returns the word wrap style. For a list of possible values, see setWordWrap.
public int insert(char key, int iPos);
Inserts a character into the text in the control at the specified position.
Return Value:
Returns the number of characters inserted.
Parameter | Description |
key
| The character to be inserted.
|
iPos
| The character index where the character will be inserted.
|
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
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
public boolean isReadOnly();
Determines whether the control is read-only.
Return Value:
Returns true if the READONLY style is set; otherwise, returns false.
public boolean isSingleLine();
Retrieves the control's single line attribute.
Return Value:
Returns false if the control text can be displayed on multiple lines; otherwise, returns true.
protected void processActionEvent(ActionEvent e);
Processes action events.
Return Value:
No return value.
Parameter | Description |
e
| The action event.
|
Remarks:
This method is called by processHostEvent and dispatches the event to a registered action listener. When overriding this method, call the super method processActionEvent to ensure the default event processing continues normally.
See Also: addActionListener
protected void processHostEvent(AWTEvent e);
Processes the specified event.
Return Value:
No return value.
Parameter | Description |
e
| The event.
|
Remarks:
This method is automatically invoked if a listener has has been registered through a call to addsXXXListener. Depending on the type of event, processHostEvent calls one of the following methods.
When overriding processHostEvent, call the super method processHostEvent to ensure the default event processing continues normally.
protected void processTextEvent(TextEvent e);
Processes text events.
Return Value:
No return value.
Parameter | Description |
e
| The text event.
|
Remarks:
This method is called by processHostEvent and dispatches the event to a registered action listener. When overriding this method, call the super method processTextEvent to ensure the default event processing continues normally.
See Also: addTextListener
public void remove(int iPos, int numberToRemove);
Deletes one or more characters from the edit control.
Return Value:
No return value.
Parameter | Description |
iPos
| The character index where the characters will be deleted.
|
numberToRemove
| The number of characters that will be deleted.
|
public synchronized void removeActionListener(ActionListener l);
Removes the specified action listener. The listener no longer receives the control's action events.
Return Value:
No return value.
Parameter | Description |
l
| The action listener to be removed.
|
See Also: addActionListener
public synchronized void removeTextListener(TextListener l);
Removes the specified text listener. The listener no longer receives the control's text events.
Return Value:
No return value.
Parameter | Description |
l
| The text listener to be removed.
|
See Also: addTextListener
public void selectAll();
Selects all of the text in the control.
Return Value:
No return value.
public void setAutoResizable(boolean auto);
Sets the control's auto-resize attribute.
Return Value:
No return value.
Parameter | Description |
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
public void setBordered(boolean b);
Sets or clears the control's border.
Return Value:
No return value.
Parameter | Description |
b
| If true, the control has a border; otherwise, it does not.
|
See Also: isBordered
public void setHorizAlign(int h);
Sets the horizontal alignment of the control's text.
Return Value:
No return value.
Parameter | Description |
h
| The horizontal alignment. You can pass one of the following values, defined by the IFxTextConstants interface.
|
public void setMaxBufferSize(int newMax);
Sets the maximum number of characters that the control can hold.
Return Value:
No return value.
Parameter | Description |
newMax
| The new maximum number of characters that the control can hold.
|
public void setOutline(IFxShape outline);
Sets an outline that the text buffer is drawn along.
Return Value:
No return value.
Parameter | Description |
outline
| An IFxShape object that specifies the outline.
|
See Also: getOutline
public void setPasswordChar(char c);
Sets the character that is displayed in the control when a password is entered.
Return Value:
No return value.
Parameter | Description |
c
| The character that will be displayed in place of password characters. If the value is zero, the password character is cleared.
|
public void setReadOnly(boolean ro);
Changes the read-only attribute of the control.
Return Value:
No return value.
Parameter | Description |
ro
| If true, the READONLY style is set; otherwise, it 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.
|
public void setSingleLine(boolean sl);
Changes the control's single line attribute.
Return Value:
No return value.
Parameter | Description |
sl
| Set to false if the control's text is displayed on multiple lines. Otherwise, the text is displayed on a 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 with the specified array of characters.
Return Value:
No return value.
Parameter | Description |
newBuff
| The array of characters to replace the text with.
|
offset
| The offset to use.
|
len
| The length of the array used.
|
public void setVertAlign(int v);
Sets the vertical alignment of the control's text.
Return Value:
No return value.
Parameter | Description |
v
| The vertical alignment. You can pass one of the following values, defined by the IFxTextConstants interface.
|
public void setWordWrap(int ww);
Sets the word wrap style.
Return Value:
No return value.
Parameter | Description |
ww
| The word wrap style. You can pass one of the following values, defined by the IFxTextConstants interface.
|
public void showCaret();
Shows the caret at the current position.
Return Value:
No return value.
public void showCaret(int iPos);
Positions and displays the caret at the specified position.
Return Value:
No return value.
Parameter | Description |
iPos
| The character index where the caret will be positioned.
|
public boolean tabbable();
Determines whether the control can be navigated to by pressing the TAB key.
Return Value:
Returns true if the control can be tabbed to; otherwise, returns false.