github link: https://github.com/AEkman/QuizApplication/tree/master/src
I have a project with FXML gui.
First i load my label in ClientController.java and make a set method:
@FXML
private TextArea textAreaConsole;
public void setTextAreaConsole(String text){
textAreaConsole.appendText(text);
}
In my other class ChatClient.java i want to send a text in variable message to textAreaConsole via the set method.
ClientController clientController = new ClientController();
clientController.setTextAreaConsole(message);
But it seems like i can't get the textAreaConsole to be initialized. I only get nullpointerexception. What am I missing? How do i initialize my label to be able to be changed via the set method, or is there a better solution?
I've tried loading the fxml file and import label again without success. I've tried instantiate the Controller in constructor without success.