int () { try { myCurrValue = Integer.parseInt(myIntField.getText()); if (myCurrValue < 0) { myCurrValue = 0; } if (myCurrValue > 10) { myCurrValue = 10; } } catch (NumberFormatException e) { //bad number entered myCurrValue = 0; } return myCurrValue; }