To convert from AWT to AFC, instances of java.awt.CheckboxMenuItem should be transformed into instances of com.ms.UICheckButton.
CheckboxMenuItem extends MenuItem: be sure to see its changes.
In AWT, to create a menu with checkboxes, you need to use CheckboxMenuItem: in AFC, though, you can use normal UICheckButtons. Further, you can instantiate UICheckButtons with UIComponents, so the checkbuttons can include images and even canvasses as part of their descriptions. You also have more style options, like hottracking and toggling. See Checkbox for more information.
This is the set of changes you need to make to port all CheckboxMenuItem methods to UICheckButton methods. Any method not listed here or below does not need to be changed.
AWT Code | AFC Code | Comments |
CheckboxMenuItem(String) | UICheckButton(String) | Better to use UIComponents (see above) |
CheckboxMenuItem(String, boolean) | UICheckButton(String); (UICheckButton).setChecked(boolean) |
Better to use UIComponents (see above) |
getState() | isChecked() | |
setState(boolean) | setChecked(boolean) |
Some methods in java.awt.CheckboxMenuItem are not directly supported in com.ms.ui.UICheckButton. Those methods and suggested changes are described here.
AWT Code/Suggested AFC Code | Comments |
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. |