TextComponent to UIEdit

To convert from AWT to AFC, instances of java.awt.TextComponent should be transformed into instances of com.ms.ui.UIEdit.

TextComponent extends Component: be sure to see its changes.

Purpose and Usage

AWT provides TextComponent as an abstract class for two types of text input components, TextArea and TextField. AFC provides one class for all three purposes, UIEdit.

 

Porting

This is the set of changes you need to make to port all TextComponent methods to UIEdit methods. Any method not listed here or below does not need to be changed.

 

AWT Code AFC Code
getCaretPosition() getCurrIndex()
getText() getValueText()
isEditable() (! isReadOnly())
select(int, int) setSelection(int, int)
setCaretPosition(int) setCurrIndex(int)
setEditable(boolean) setReadOnly(! boolean)
setText() setValueText()
addTextListener(TextListener) addTextListener(IUITextListener)
removeTextListener(TextListener) removeTextListener(IUITextListener)

 

Unsupported Methods

Some methods in java.awt.TextComponent are not directly supported in com.ms.ui.UIEdit. Those methods and suggested changes are described here.

 

AWT Code/Suggested AFC Code Comments
paramString()

getName(), etc.

Use the appropriate getXXX function to gather the information you need.
setSelectionEnd(int)

setSelection(getSelectionStart(), int)

 
setSelectionStart(int)

setSelection(int, getSelectionEnd())