Created
December 17, 2014 10:10
-
-
Save O5ten/0dcb7580610320e34abd to your computer and use it in GitHub Desktop.
validatable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
validator: { v -> | |
try{ | |
v = parseInt(v) | |
} catch (NumberFormatException e) { | |
field.background = Color.RED | |
field.revalidate() | |
return false | |
} | |
if (v >= 0 && v < MAX_VALUE) { | |
field.background = Color.WHITE | |
field.revalidate() | |
return true | |
} else { | |
field.background = Color.RED | |
field.revalidate() | |
return false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment