Change javascript to java calls to match javafx