switch (event.detail) { case ACC.ROLE_RADIOBUTTON: case ACC.ROLE_CHECKBUTTON: case ACC.ROLE_SCROLLBAR: case ACC.ROLE_TABITEM: case ACC.ROLE_SLIDER: case ACC.ROLE_PROGRESSBAR: if (event.result == null) return code; int number = Integer.parseInt(event.result); OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFTypeRef, 4, new int [] {number}); break; case ACC.ROLE_TABFOLDER: case ACC.ROLE_COMBOBOX: case ACC.ROLE_TEXT: if (event.result == null) return code; OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, new int [] {stringToStringRef(event.result)}); break; case ACC.ROLE_LABEL:  AccessibleEvent e = new AccessibleEvent(this); e.childID = getChildIDFromEvent(theEvent); e.result = osValueAttribute; for (int i = 0; i < accessibleListeners.size(); i++) { AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i); listener.getName(e);
int role = event.detail; String value = event.result; if (value != null || role == ACC.ROLE_LABEL) { int stringRef = 0; switch (role) { case ACC.ROLE_RADIOBUTTON: case ACC.ROLE_CHECKBUTTON: case ACC.ROLE_SCROLLBAR: case ACC.ROLE_TABITEM: case ACC.ROLE_SLIDER: case ACC.ROLE_PROGRESSBAR: try { int number = Integer.parseInt(value); OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeSInt32, 4, new int [] {number}); return OS.noErr; } catch (NumberFormatException ex) { if (value.equalsIgnoreCase("true")) { OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeBoolean, 4, new boolean [] {true}); return OS.noErr; } if (value.equalsIgnoreCase("false")) { OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeBoolean, 4, new boolean [] {false}); return OS.noErr; } } break; case ACC.ROLE_TABFOLDER:  case ACC.ROLE_COMBOBOX: case ACC.ROLE_TEXT: stringRef = stringToStringRef(value); break; case ACC.ROLE_LABEL:  AccessibleEvent e = new AccessibleEvent(this); e.childID = childID; e.result = null; for (int i = 0; i < accessibleListeners.size(); i++) { AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i); listener.getName(e); } if (e.result != null) { stringRef = stringToStringRef(e.result); } else { if (value != null) stringRef = stringToStringRef(value); } break;
	int getValueAttribute (int nextHandler, int theEvent, int userData) {		int code = OS.CallNextEventHandler (nextHandler, theEvent);		String osValueAttribute = null;		AccessibleControlEvent event = new AccessibleControlEvent(this);		event.childID = getChildIDFromEvent(theEvent);		event.result = osValueAttribute;		for (int i = 0; i < accessibleControlListeners.size(); i++) {			AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);			listener.getRole(event);			listener.getValue(event);		}		switch (event.detail) {		case ACC.ROLE_RADIOBUTTON: // 1 = on, 0 = off		case ACC.ROLE_CHECKBUTTON: // 1 = checked, 0 = unchecked, 2 = mixed		case ACC.ROLE_SCROLLBAR: // numeric value representing the position of the scroller		case ACC.ROLE_TABITEM:  // 1 = selected, 0 = not selected		case ACC.ROLE_SLIDER: // the value associated with the position of the slider thumb		case ACC.ROLE_PROGRESSBAR: // the value associated with the fill level of the progress bar			if (event.result == null) return code;			int number = Integer.parseInt(event.result);			OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFTypeRef, 4, new int [] {number});			break;		case ACC.ROLE_TABFOLDER: // the accessibility object representing the currently selected tab item		case ACC.ROLE_COMBOBOX: // text of the currently selected item		case ACC.ROLE_TEXT: // text in the text field			if (event.result == null) return code;			OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, new int [] {stringToStringRef(event.result)});			break;		case ACC.ROLE_LABEL: // text in the label			/* On a Mac, the 'value' of a label is the same as the 'name' of the label. */			AccessibleEvent e = new AccessibleEvent(this);			e.childID = getChildIDFromEvent(theEvent);			e.result = osValueAttribute;			for (int i = 0; i < accessibleListeners.size(); i++) {				AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);				listener.getName(e);			}			if (e.result == null) return code;			OS.SetEventParameter (theEvent, OS.kEventParamAccessibleAttributeValue, OS.typeCFStringRef, 4, new int [] {stringToStringRef(e.result)});			break;		}		return OS.noErr;	}