Cześć.
Dopiero zaczynam z JavaFX i mam problem z którym nie mogę sobie poradzić.
Mianowicie wyskakuje mi błąd "java.lang.NullPointerException" w miejscu gdzie wykonuje analyzeTextArea.appendText(text);
System.out.println(text); normalnie wyświetla się w konsoli.
Co tutaj robie źle?
Controller:
public class NGMainController {
@FXML
private Pane NGMainWindowPane;
@FXML
public TextArea analyzeTextArea;
@FXML
void initialize() {
}
}
Main:
public class NGMain extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("NGMain.fxml"));
primaryStage.setTitle("Analyzer");
primaryStage.setScene(new Scene(root, 800, 600));
primaryStage.setResizable(false);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
Klasa z której próbuje dodać tekst do TextArea:
public class ParseNG extends NGMainController{
private String webSource;
private Document matchDocument;
...
...
...
private void checkTest(){
String text = "Jakiś tam tekst!";
analyzeTextArea.appendText(text);
System.out.println(text);
}
Pozdrawiam.