I try to develop a chat client with javafx, I have a java class that implements Runnable. When I create an instance this class since main.fx, the class performs 5 or 6 loop then the thread dies automatically. I have no idea regarding this problem. Also, do I have to implement threads in javafx in a different way or as i would to do in java? Any help will interest me. Thank you.