JavaFX Change label text from another class with controller
I want to change the text of a Label with the controller from another class. I have made a method in the FXMLDocumentController, which sets the text to the label: public void setLabelText(String text) { lbZeit.setText(text); } Now I want to change this text from another class like my SerialHandlerClass. First, I need the controller, am I right? So I did this: FXMLLoader loader = new FXMLLoader(FXMLDocumentController.class.getResource("FXMLDocument.fxml")); loader.load(); controller = (FXMLDocumentController) loader.getController(); Now I run the "setLabelText" method.... controller