To convert from AWT to AFC, instances of java.awt.Checkbox should be transformed into instances of com.ms.ui.UICheckButton.
Checkbox extends Component: be sure to see its changes.
In AWT, all Checkbox components are limited to strings. AFC allows you to do this: however, it also allows you to enter UIComponents as UICheckButtons. In this manner, not only can you have text components adjacent to your checkbutton, but you can have images and even canvasses. You also have more control over the look of the components, including hottracking, toggle methods, and selection.
The transformation of AWT to AFC components is simple: to add text components, for example, you would replace
add("foo");
by
add(new UIText("Foo"));
This is the set of changes you need to make to port all Checkbox methods to UICheckButton methods. Any method not listed here or below does not need to be changed.
AWT Code | AFC Code | Comments |
Checkbox(String) | UICheckButton(String) | Better to use UIComponents (see above) |
Checkbox(String, boolean) | UICheckButton(String); (UICheckButton).setChecked(boolean) |
Better to use UIComponents (see above) |
getLabel() | getName() | |
getState() | isChecked() | |
setLabel(String) | setName(String) | |
setState() | setChecked() |
Some methods in java.awt.Checkbox are not directly supported in com.ms.ui.UICheckButton. Those methods and suggested changes are described here.
AWT Code/Suggested AFC Code | Comments |
Checkbox(String,
boolean, CheckboxGroup) UICheckButton(String); |
AFC does not have a CheckboxGroup: see that page for more information. |
Checkbox(String, CheckboxGroup, boolean) UICheckButton(String); |
AFC does not have a CheckboxGroup: see that page for more information. |
getCheckboxGroup() (no suggestions) |
AFC does not have a CheckboxGroup: see that page for more information. |
setCheckboxGroup(CheckboxGroup) (no suggestions) |
AFC does not have a CheckboxGroup: see that page for more information. |
getSelectedObjects() getName() |
getSelectedObjects() returns an array containing the label: getName() will just return the label itself. |
paramString() getName() or isChecked() |
paramString() returns a list of current settings: instead, you should just get the setting you want. |