I haven’t done this in code, but here’s the gist of a very simplistic way to try:
To read the value in the TextField, I’d first set a String to the TextField’s Text, and search that string for commas and remove them. Then I’d call Double.Parse(). It’ll throw a InvalidArgumentException if the input value is incorrect, so you can present an error message to the user in the exception handler. Only set the variable you use to store the Double if the Parse doesn’t throw an exception.
To write a Double value to the TextField with a thousands separator, first convert the number to a String. If the Double is over 1000, search the String for the decimal point. If one is found, insert a comma at an index 3 spaces before it.