When to set UI Component private / public in Javafx :
- If you write UI component in private controller class then it is mandetory to write annotation for Example - @FXML Private TextFiled textFiled; If you declare UI component as public then there is no need to write annotation for Example : public TextFiled textFiled; Better practice is to Write annotation and keep all UI component private in Controller class.