Not trying to be language specific, but the idea is to create a number text control that knows if the value is valid. It's easy to get hung up on the exact roles of M, V, and C. However, for all practical purposes, it makes sense to combine the View and the Controller for Desktop like applications. Swing took that approach because the controller and view had very tight coupling and it made sense to combine them into one. Read up this nice discussion on c2 about the topic.
class NumberTextBox extends TextBox {
bool isValid() {
return IsValidNumber(this.Value);
}
}
ageTextBox = new NumberTextBox();
ageTextBox.addChangeHandler(function() {
this.Color = this.isValid ? WindowColor : Pink;
});