public void Update ()
{
maChildrenSelector.removeAll ();
// Determine whether multi selection is possible.
XAccessibleStateSet aStateSet = mxContext.getAccessibleStateSet();
boolean bMultiSelectable = false;
ButtonGroup aButtonGroup = null;
if (aStateSet!=null && aStateSet.contains(AccessibleStateType.MULTI_SELECTABLE))
{
bMultiSelectable = true;
maTypeLabel.setText ("multi selectable");
}
else
{
maTypeLabel.setText ("single selectable");
aButtonGroup = new ButtonGroup ();
}
int nCount = mxContext.getAccessibleChildCount();
for (int i=0; i<nCount; i++)
{
try
{
XAccessible xChild = mxContext.getAccessibleChild(i);
XAccessibleContext xChildContext = xChild.getAccessibleContext();
String sName = i + " " + xChildContext.getAccessibleName();
JToggleButton aChild;
if (bMultiSelectable)
aChild = new JCheckBox (sName);
else
{
aChild = new JRadioButton (sName);
aButtonGroup.add (aChild);
}
XAccessibleStateSet aChildStateSet = mxContext.getAccessibleStateSet();
aChild.setSelected (aChildStateSet!=null
&& aChildStateSet.contains(AccessibleStateType.SELECTED));
aChild.addActionListener (this);
maChildrenSelector.add (aChild);
}