@bkenn Although, I haven't looked into the code with much detail. You might be falling into a race condition, where your request to focus is called before the TextFormatter completes its job and therefore adding a
runLater
helps. You can confirm this by adding print statments in both
refocus()
and TextFormatter.