void setTextField(int fieldName, int value, boolean commit) { int max = calendar.getActualMaximum(fieldName); int min = calendar.getActualMinimum(fieldName); if (fieldName == Calendar.YEAR) { max = 9999; min = 1000; } if (value > max) value = min;
void setTextField(int fieldName, int value, boolean commit, boolean adjustMonth) {
void setTextField(int fieldName, int value, boolean commit) {	int max = calendar.getActualMaximum(fieldName);	int min = calendar.getActualMinimum(fieldName);	if (fieldName == Calendar.YEAR) {		max = 9999;		min = 1000;	}	if (value > max) value = min; // wrap	if (commit) {		if (fieldName == Calendar.YEAR) {			/* Special case: convert 2-digit years into reasonable 4-digit years. */			if (value < 30) value += 2000;			else if (value <= 99) value += 1900;		}		if (value < min) value = max; // wrap	}	int start = fieldIndices[currentField].x;	int end = fieldIndices[currentField].y;	text.setSelection(start, end);	String newValue;	if (fieldName == Calendar.AM_PM) {		newValue = value == Calendar.AM ? "AM" : "PM";	} else {		StringBuffer buffer = new StringBuffer(String.valueOf(value));		int prependCount = end - start - buffer.length();		for (int i = 0; i < prependCount; i++) {			buffer.insert(0, ' ');		}		newValue = buffer.toString();	}	ignoreVerify = true;	text.insert(newValue);	ignoreVerify = false;	selectField(currentField);	if (commit) setField(fieldName, value);}