JavaFX Exception in thread "JavaFX Application Thread"

Bitte aktiviere JavaScript!
Hallo liebes Forum,

schon mal vorweg ich bin ein ziemlich Neuling, was Java und JavaFX angeht. Momentan versuche ich mich an einem Programm, das Excell-Dateien Zeile für Zeile nacheinander Anzeigen soll. Leider kriege ich momentan Exceptions geworfen, die ich nicht verstehe. Ich entschuldige mich vorab für die Unübersichtlichkeit, aber wie gesagt ich bin noch ein Anfänger.

Danke

Controller.java:

Java:
package sample;

import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*;
import javafx.scene.text.Text;
import javafx.scene.control.TreeItem;

import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.File;
import java.io.FileInputStream;
import java.net.URL;
import java.util.Arrays;
import java.util.ResourceBundle;

public class Controller implements Initializable {

    //Einlesen des Ordners

    File f = new File("C:/Users/kjsch/OneDrive/Desktop/Test");
    String[] steckerarray = f.list();


        @FXML
        private Tab dgp;

        @FXML
        private Tab fs;

        @FXML
        private Tab hck;

        @FXML
        private ListView<?> fehlerproto;

        @FXML
        private Label label;

        @FXML
        private ProgressBar ladebalken;

        @FXML
        private Text prüfstatusAnzeige;

        @FXML
        private RadioButton dummy;

        @FXML
        private Label labelSl;

        @FXML
        private TextField suchen;

        @FXML
        private TreeView<String> steckertreeview;

    public void mouseClick() {

        int zeile = 1;
        int spalte = 0;

        TreeItem<String>  itemMouse = steckertreeview.getSelectionModel().getSelectedItem();

        String hilfsString = "C:/Users/kjsch/OneDrive/Desktop/Test/"+ itemMouse.getValue();

        /**Zugriff auf Exceltabelle*/
        try(FileInputStream excelFile =new FileInputStream(new File (hilfsString))) {
            Workbook workbook = new XSSFWorkbook(excelFile);
            Sheet sheet = workbook.getSheet("Durchgangsprüfung");

            while(zeile<4) {
                while (spalte < 7) {

                    Row row = sheet.getRow(zeile);
                    Cell cell = row.getCell(spalte);

                    if (cell != null) {

                        System.out.println(cell);
                        spalte++;

                    } else {

                        spalte++;

                    }
                }
                if(zeile == 3){

                    System.out.println("Exceltabelle zuende");

                }
                zeile++;
                spalte = 0;
            }
        }catch(Exception e){

            System.out.print(e);

        }



    }

    @Override
    public void initialize(URL location, ResourceBundle resources) {


        /**Grundstruktur der TreeView*/

        TreeItem<String>root=new TreeItem<>("Stecker");
        root.setExpanded(true);

        TreeItem<String>item1=new TreeItem("100er");
        TreeItem<String>item2=new TreeItem("200er");
        TreeItem<String>item3=new TreeItem("300er");
        TreeItem<String>item4=new TreeItem("400er");
        TreeItem<String>item5=new TreeItem("500er");
        TreeItem<String>item6=new TreeItem("600er");
        TreeItem<String>item7=new TreeItem("700er");
        TreeItem<String>item8=new TreeItem("800er");
        TreeItem<String>item9=new TreeItem("900er");

        root.getChildren().addAll(item1, item2, item3, item4, item5, item6, item7, item8, item9);

        TreeItem<String>childa0 =new TreeItem("100er");
        TreeItem<String>childa1=new TreeItem("110er");
        TreeItem<String>childa2=new TreeItem("120er");
        TreeItem<String>childa3 =new TreeItem("130er");
        TreeItem<String>childa4=new TreeItem("140er");
        TreeItem<String>childa5=new TreeItem("150er");
        TreeItem<String>childa6 =new TreeItem("160er");
        TreeItem<String>childa7=new TreeItem("170er");
        TreeItem<String>childa8=new TreeItem("180er");
        TreeItem<String>childa9=new TreeItem("190er");

        item1.getChildren().addAll(childa0, childa1, childa2, childa3, childa4, childa5, childa6, childa7, childa8, childa9);

        TreeItem<String>childb0 =new TreeItem("200er");
        TreeItem<String>childb1=new TreeItem("210er");
        TreeItem<String>childb2=new TreeItem("220er");
        TreeItem<String>childb3 =new TreeItem("230er");
        TreeItem<String>childb4=new TreeItem("240er");
        TreeItem<String>childb5=new TreeItem("250er");
        TreeItem<String>childb6 =new TreeItem("260er");
        TreeItem<String>childb7=new TreeItem("270er");
        TreeItem<String>childb8=new TreeItem("280er");
        TreeItem<String>childb9=new TreeItem("290er");

        item2.getChildren().addAll(childb0, childb1, childb2, childb3, childb4, childb5, childb6, childb7, childb8, childb9);

        TreeItem<String>childc0 =new TreeItem("300er");
        TreeItem<String>childc1=new TreeItem("310er");
        TreeItem<String>childc2=new TreeItem("320er");
        TreeItem<String>childc3 =new TreeItem("330er");
        TreeItem<String>childc4=new TreeItem("340er");
        TreeItem<String>childc5=new TreeItem("350er");
        TreeItem<String>childc6 =new TreeItem("360er");
        TreeItem<String>childc7=new TreeItem("370er");
        TreeItem<String>childc8=new TreeItem("380er");
        TreeItem<String>childc9=new TreeItem("390er");

        item3.getChildren().addAll(childc0, childc1, childc2, childc3, childc4, childc5, childc6, childc7, childc8, childc9);

        TreeItem<String>childd0 =new TreeItem("400er");
        TreeItem<String>childd1=new TreeItem("410er");
        TreeItem<String>childd2=new TreeItem("420er");
        TreeItem<String>childd3 =new TreeItem("430er");
        TreeItem<String>childd4=new TreeItem("440er");
        TreeItem<String>childd5=new TreeItem("450er");
        TreeItem<String>childd6 =new TreeItem("460er");
        TreeItem<String>childd7=new TreeItem("470er");
        TreeItem<String>childd8=new TreeItem("480er");
        TreeItem<String>childd9=new TreeItem("490er");

        item4.getChildren().addAll(childd0, childd1, childd2, childd3, childd4, childd5, childd6, childd7, childd8, childd9);


        TreeItem<String>childe0 =new TreeItem("500er");
        TreeItem<String>childe1=new TreeItem("510er");
        TreeItem<String>childe2=new TreeItem("520er");
        TreeItem<String>childe3 =new TreeItem("530er");
        TreeItem<String>childe4=new TreeItem("540er");
        TreeItem<String>childe5=new TreeItem("550er");
        TreeItem<String>childe6 =new TreeItem("560er");
        TreeItem<String>childe7=new TreeItem("570er");
        TreeItem<String>childe8=new TreeItem("580er");
        TreeItem<String>childe9=new TreeItem("590er");

        item5.getChildren().addAll(childe0, childe1, childe2, childe3, childe4, childe5, childe6, childe7, childe8, childe9);

        TreeItem<String>childf0 =new TreeItem("600er");
        TreeItem<String>childf1=new TreeItem("610er");
        TreeItem<String>childf2=new TreeItem("620er");
        TreeItem<String>childf3 =new TreeItem("630er");
        TreeItem<String>childf4=new TreeItem("640er");
        TreeItem<String>childf5=new TreeItem("650er");
        TreeItem<String>childf6 =new TreeItem("660er");
        TreeItem<String>childf7=new TreeItem("670er");
        TreeItem<String>childf8=new TreeItem("680er");
        TreeItem<String>childf9=new TreeItem("690er");

        item6.getChildren().addAll(childf0, childf1, childf2, childf3, childf4, childf5, childf6, childf7, childf8, childf9);

        TreeItem<String>childg0 =new TreeItem("700er");
        TreeItem<String>childg1=new TreeItem("710er");
        TreeItem<String>childg2=new TreeItem("720er");
        TreeItem<String>childg3 =new TreeItem("730er");
        TreeItem<String>childg4=new TreeItem("740er");
        TreeItem<String>childg5=new TreeItem("750er");
        TreeItem<String>childg6 =new TreeItem("760er");
        TreeItem<String>childg7=new TreeItem("770er");
        TreeItem<String>childg8=new TreeItem("780er");
        TreeItem<String>childg9=new TreeItem("790er");

        item7.getChildren().addAll(childg0, childg1, childg2, childg3, childg4, childg5, childg6, childg7, childg8, childg9);

        TreeItem<String>childh0 =new TreeItem("800er");
        TreeItem<String>childh1=new TreeItem("810er");
        TreeItem<String>childh2=new TreeItem("820er");
        TreeItem<String>childh3 =new TreeItem("830er");
        TreeItem<String>childh4=new TreeItem("840er");
        TreeItem<String>childh5=new TreeItem("850er");
        TreeItem<String>childh6 =new TreeItem("860er");
        TreeItem<String>childh7=new TreeItem("870er");
        TreeItem<String>childh8=new TreeItem("880er");
        TreeItem<String>childh9=new TreeItem("890er");

        item8.getChildren().addAll(childh0, childh1, childh2, childh3, childh4, childh5, childh6, childh7, childh8, childh9);

        TreeItem<String>childi0 =new TreeItem("900er");
        TreeItem<String>childi1=new TreeItem("910er");
        TreeItem<String>childi2=new TreeItem("920er");
        TreeItem<String>childi3 =new TreeItem("930er");
        TreeItem<String>childi4=new TreeItem("940er");
        TreeItem<String>childi5=new TreeItem("950er");
        TreeItem<String>childi6 =new TreeItem("960er");
        TreeItem<String>childi7=new TreeItem("970er");
        TreeItem<String>childi8=new TreeItem("980er");
        TreeItem<String>childi9=new TreeItem("990er");

        item9.getChildren().addAll(childi0, childi1, childi2, childi3, childi4, childi5, childi6, childi7, childi8, childi9);

        steckertreeview.setRoot(root);

        /**Dynamische Füllen der leafs*/

        Arrays.sort(steckerarray);

        //Füllen des Hilfsarrays mit Dateinamen
        for(int i = 0; i<steckerarray.length; i++) {
            switch(steckerarray[i].charAt(13)){
                case '1':
                    switch(steckerarray[i].charAt(14)){
                        case '0':
                            TreeItem<String>leaf0 = new TreeItem(steckerarray[i]);
                            childa0.getChildren().addAll(leaf0);
                            break;
                        case '1':
                            TreeItem<String>leaf1 = new TreeItem(steckerarray[i]);
                            childa1.getChildren().addAll(leaf1);
                            break;
                        case '2':
                            TreeItem<String>leaf2 = new TreeItem(steckerarray[i]);
                            childa2.getChildren().addAll(leaf2);
                            break;
                        case '3':
                            TreeItem<String>leaf3 = new TreeItem(steckerarray[i]);
                            childa3.getChildren().addAll(leaf3);
                            break;
                        case '4':
                            TreeItem<String>leaf4 = new TreeItem(steckerarray[i]);
                            childa4.getChildren().addAll(leaf4);
                            break;
                        case '5':
                            TreeItem<String>leaf5 = new TreeItem(steckerarray[i]);
                            childa5.getChildren().addAll(leaf5);
                            break;
                        case '6':
                            TreeItem<String>leaf6 = new TreeItem(steckerarray[i]);
                            childa6.getChildren().addAll(leaf6);
                            break;
                        case '7':
                            TreeItem<String>leaf7 = new TreeItem(steckerarray[i]);
                            childa7.getChildren().addAll(leaf7);
                            break;
                        case '8':
                            TreeItem<String>leaf8 = new TreeItem(steckerarray[i]);
                            childa8.getChildren().addAll(leaf8);
                            break;
                        case '9':
                            TreeItem<String>leaf9 = new TreeItem(steckerarray[i]);
                            childa9.getChildren().addAll(leaf9);
                            break;

                    }

                case '2':
                    switch(steckerarray[i].charAt(14)){
                        case '0':
                            TreeItem<String>leaf10 = new TreeItem(steckerarray[i]);
                            childb0.getChildren().addAll(leaf10);
                            break;
                        case '1':
                            TreeItem<String>leaf11 = new TreeItem(steckerarray[i]);
                            childb1.getChildren().addAll(leaf11);
                            break;
                        case '2':
                            TreeItem<String>leaf12 = new TreeItem(steckerarray[i]);
                            childb2.getChildren().addAll(leaf12);
                            break;
                        case '3':
                            TreeItem<String>leaf13 = new TreeItem(steckerarray[i]);
                            childb3.getChildren().addAll(leaf13);
                            break;
                        case '4':
                            TreeItem<String>leaf14 = new TreeItem(steckerarray[i]);
                            childb4.getChildren().addAll(leaf14);
                            break;
                        case '5':
                            TreeItem<String>leaf15 = new TreeItem(steckerarray[i]);
                            childb5.getChildren().addAll(leaf15);
                            break;
                        case '6':
                            TreeItem<String>leaf16 = new TreeItem(steckerarray[i]);
                            childb6.getChildren().addAll(leaf16);
                            break;
                        case '7':
                            TreeItem<String>leaf17 = new TreeItem(steckerarray[i]);
                            childb7.getChildren().addAll(leaf17);
                            break;
                        case '8':
                            TreeItem<String>leaf18 = new TreeItem(steckerarray[i]);
                            childb8.getChildren().addAll(leaf18);
                            break;
                        case '9':
                            TreeItem<String>leaf19 = new TreeItem(steckerarray[i]);
                            childb9.getChildren().addAll(leaf19);
                            break;

                    }

                case '3':
                    switch(steckerarray[i].charAt(14)){
                        case '0':
                            TreeItem<String>leaf20 = new TreeItem(steckerarray[i]);
                            childc0.getChildren().addAll(leaf20);
                            break;
                        case '1':
                            TreeItem<String>leaf21 = new TreeItem(steckerarray[i]);
                            childc1.getChildren().addAll(leaf21);
                            break;
                        case '2':
                            TreeItem<String>leaf22 = new TreeItem(steckerarray[i]);
                            childc2.getChildren().addAll(leaf22);
                            break;
                        case '3':
                            TreeItem<String>leaf23 = new TreeItem(steckerarray[i]);
                            childc3.getChildren().addAll(leaf23);
                            break;
                        case '4':
                            TreeItem<String>leaf24 = new TreeItem(steckerarray[i]);
                            childc4.getChildren().addAll(leaf24);
                            break;
                        case '5':
                            TreeItem<String>leaf25 = new TreeItem(steckerarray[i]);
                            childc5.getChildren().addAll(leaf25);
                            break;
                        case '6':
                            TreeItem<String>leaf26 = new TreeItem(steckerarray[i]);
                            childc6.getChildren().addAll(leaf26);
                            break;
                        case '7':
                            TreeItem<String>leaf27 = new TreeItem(steckerarray[i]);
                            childc7.getChildren().addAll(leaf27);
                            break;
                        case '8':
                            TreeItem<String>leaf28 = new TreeItem(steckerarray[i]);
                            childc8.getChildren().addAll(leaf28);
                            break;
                        case '9':
                            TreeItem<String>leaf29 = new TreeItem(steckerarray[i]);
                            childc9.getChildren().addAll(leaf29);
                            break;

                    }

                case '4':
                    switch(steckerarray[i].charAt(14)){
                        case '0':
                            TreeItem<String>leaf30 = new TreeItem(steckerarray[i]);
                            childd0.getChildren().addAll(leaf30);
                            break;
                        case '1':
                            TreeItem<String>leaf31 = new TreeItem(steckerarray[i]);
                            childd1.getChildren().addAll(leaf31);
                            break;
                        case '2':
                            TreeItem<String>leaf32 = new TreeItem(steckerarray[i]);
                            childd2.getChildren().addAll(leaf32);
                            break;
                        case '3':
                            TreeItem<String>leaf33 = new TreeItem(steckerarray[i]);
                            childd3.getChildren().addAll(leaf33);
                            break;
                        case '4':
                            TreeItem<String>leaf34 = new TreeItem(steckerarray[i]);
                            childd4.getChildren().addAll(leaf34);
                            break;
                        case '5':
                            TreeItem<String>leaf35 = new TreeItem(steckerarray[i]);
                            childd5.getChildren().addAll(leaf35);
                            break;
                        case '6':
                            TreeItem<String>leaf36 = new TreeItem(steckerarray[i]);
                            childd6.getChildren().addAll(leaf36);
                            break;
                        case '7':
                            TreeItem<String>leaf37 = new TreeItem(steckerarray[i]);
                            childd7.getChildren().addAll(leaf37);
                            break;
                        case '8':
                            TreeItem<String>leaf38 = new TreeItem(steckerarray[i]);
                            childd8.getChildren().addAll(leaf38);
                            break;
                        case '9':
                            TreeItem<String>leaf39 = new TreeItem(steckerarray[i]);
                            childd9.getChildren().addAll(leaf39);
                            break;

                    }

                case '5':
                    switch(steckerarray[i].charAt(14)){
                        case '0':
                            TreeItem<String>leaf40 = new TreeItem(steckerarray[i]);
                            childe0.getChildren().addAll(leaf40);
                            break;
                        case '1':
                            TreeItem<String>leaf41 = new TreeItem(steckerarray[i]);
                            childe1.getChildren().addAll(leaf41);
                            break;
                        case '2':
                            TreeItem<String>leaf42 = new TreeItem(steckerarray[i]);
                            childe2.getChildren().addAll(leaf42);
                            break;
                        case '3':
                            TreeItem<String>leaf43 = new TreeItem(steckerarray[i]);
                            childe3.getChildren().addAll(leaf43);
                            break;
                        case '4':
                            TreeItem<String>leaf44 = new TreeItem(steckerarray[i]);
                            childe4.getChildren().addAll(leaf44);
                            break;
                        case '5':
                            TreeItem<String>leaf45 = new TreeItem(steckerarray[i]);
                            childe5.getChildren().addAll(leaf45);
                            break;
                        case '6':
                            TreeItem<String>leaf46 = new TreeItem(steckerarray[i]);
                            childe6.getChildren().addAll(leaf46);
                            break;
                        case '7':
                            TreeItem<String>leaf47 = new TreeItem(steckerarray[i]);
                            childe7.getChildren().addAll(leaf47);
                            break;
                        case '8':
                            TreeItem<String>leaf48 = new TreeItem(steckerarray[i]);
                            childe8.getChildren().addAll(leaf48);
                            break;
                        case '9':
                            TreeItem<String>leaf49 = new TreeItem(steckerarray[i]);
                            childe9.getChildren().addAll(leaf49);
                            break;

                    }

                case '6':
                    switch(steckerarray[i].charAt(14)){
                        case '0':
                            TreeItem<String>leaf50 = new TreeItem(steckerarray[i]);
                            childf0.getChildren().addAll(leaf50);
                            break;
                        case '1':
                            TreeItem<String>leaf51 = new TreeItem(steckerarray[i]);
                            childf1.getChildren().addAll(leaf51);
                            break;
                        case '2':
                            TreeItem<String>leaf52 = new TreeItem(steckerarray[i]);
                            childf2.getChildren().addAll(leaf52);
                            break;
                        case '3':
                            TreeItem<String>leaf53 = new TreeItem(steckerarray[i]);
                            childf3.getChildren().addAll(leaf53);
                            break;
                        case '4':
                            TreeItem<String>leaf54 = new TreeItem(steckerarray[i]);
                            childf4.getChildren().addAll(leaf54);
                            break;
                        case '5':
                            TreeItem<String>leaf55 = new TreeItem(steckerarray[i]);
                            childf5.getChildren().addAll(leaf55);
                            break;
                        case '6':
                            TreeItem<String>leaf56 = new TreeItem(steckerarray[i]);
                            childf6.getChildren().addAll(leaf56);
                            break;
                        case '7':
                            TreeItem<String>leaf57 = new TreeItem(steckerarray[i]);
                            childf7.getChildren().addAll(leaf57);
                            break;
                        case '8':
                            TreeItem<String>leaf58 = new TreeItem(steckerarray[i]);
                            childf8.getChildren().addAll(leaf58);
                            break;
                        case '9':
                            TreeItem<String>leaf59 = new TreeItem(steckerarray[i]);
                            childf9.getChildren().addAll(leaf59);
                            break;

                    }

                case '7':
                    switch(steckerarray[i].charAt(14)){
                        case '0':
                            TreeItem<String>leaf60 = new TreeItem(steckerarray[i]);
                            childg0.getChildren().addAll(leaf60);
                            break;
                        case '1':
                            TreeItem<String>leaf61 = new TreeItem(steckerarray[i]);
                            childg1.getChildren().addAll(leaf61);
                            break;
                        case '2':
                            TreeItem<String>leaf62 = new TreeItem(steckerarray[i]);
                            childg2.getChildren().addAll(leaf62);
                            break;
                        case '3':
                            TreeItem<String>leaf63 = new TreeItem(steckerarray[i]);
                            childg3.getChildren().addAll(leaf63);
                            break;
                        case '4':
                            TreeItem<String>leaf64 = new TreeItem(steckerarray[i]);
                            childg4.getChildren().addAll(leaf64);
                            break;
                        case '5':
                            TreeItem<String>leaf65 = new TreeItem(steckerarray[i]);
                            childg5.getChildren().addAll(leaf65);
                            break;
                        case '6':
                            TreeItem<String>leaf66 = new TreeItem(steckerarray[i]);
                            childg6.getChildren().addAll(leaf66);
                            break;
                        case '7':
                            TreeItem<String>leaf67 = new TreeItem(steckerarray[i]);
                            childg7.getChildren().addAll(leaf67);
                            break;
                        case '8':
                            TreeItem<String>leaf68 = new TreeItem(steckerarray[i]);
                            childg8.getChildren().addAll(leaf68);
                            break;
                        case '9':
                            TreeItem<String>leaf69 = new TreeItem(steckerarray[i]);
                            childg9.getChildren().addAll(leaf69);
                            break;

                    }

                case '8':
                    switch(steckerarray[i].charAt(14)){
                        case '0':
                            TreeItem<String>leaf70 = new TreeItem(steckerarray[i]);
                            childh0.getChildren().addAll(leaf70);
                            break;
                        case '1':
                            TreeItem<String>leaf71 = new TreeItem(steckerarray[i]);
                            childh1.getChildren().addAll(leaf71);
                            break;
                        case '2':
                            TreeItem<String>leaf72 = new TreeItem(steckerarray[i]);
                            childh2.getChildren().addAll(leaf72);
                            break;
                        case '3':
                            TreeItem<String>leaf73 = new TreeItem(steckerarray[i]);
                            childh3.getChildren().addAll(leaf73);
                            break;
                        case '4':
                            TreeItem<String>leaf74 = new TreeItem(steckerarray[i]);
                            childh4.getChildren().addAll(leaf74);
                            break;
                        case '5':
                            TreeItem<String>leaf75 = new TreeItem(steckerarray[i]);
                            childh5.getChildren().addAll(leaf75);
                            break;
                        case '6':
                            TreeItem<String>leaf76 = new TreeItem(steckerarray[i]);
                            childh6.getChildren().addAll(leaf76);
                            break;
                        case '7':
                            TreeItem<String>leaf77 = new TreeItem(steckerarray[i]);
                            childh7.getChildren().addAll(leaf77);
                            break;
                        case '8':
                            TreeItem<String>leaf78 = new TreeItem(steckerarray[i]);
                            childh8.getChildren().addAll(leaf78);
                            break;
                        case '9':
                            TreeItem<String>leaf79 = new TreeItem(steckerarray[i]);
                            childh9.getChildren().addAll(leaf79);
                            break;

                    }

                case '9':
                    switch(steckerarray[i].charAt(14)){
                        case '0':
                            TreeItem<String>leaf80 = new TreeItem(steckerarray[i]);
                            childi0.getChildren().addAll(leaf80);
                            break;
                        case '1':
                            TreeItem<String>leaf81 = new TreeItem(steckerarray[i]);
                            childi1.getChildren().addAll(leaf81);
                            break;
                        case '2':
                            TreeItem<String>leaf82 = new TreeItem(steckerarray[i]);
                            childi2.getChildren().addAll(leaf82);
                            break;
                        case '3':
                            TreeItem<String>leaf83 = new TreeItem(steckerarray[i]);
                            childi3.getChildren().addAll(leaf83);
                            break;
                        case '4':
                            TreeItem<String>leaf84 = new TreeItem(steckerarray[i]);
                            childi4.getChildren().addAll(leaf84);
                            break;
                        case '5':
                            TreeItem<String>leaf85 = new TreeItem(steckerarray[i]);
                            childi5.getChildren().addAll(leaf85);
                            break;
                        case '6':
                            TreeItem<String>leaf86 = new TreeItem(steckerarray[i]);
                            childi6.getChildren().addAll(leaf86);
                            break;
                        case '7':
                            TreeItem<String>leaf87 = new TreeItem(steckerarray[i]);
                            childi7.getChildren().addAll(leaf87);
                            break;
                        case '8':
                            TreeItem<String>leaf88 = new TreeItem(steckerarray[i]);
                            childi8.getChildren().addAll(leaf88);
                            break;
                        case '9':
                            TreeItem<String>leaf89 = new TreeItem(steckerarray[i]);
                            childi9.getChildren().addAll(leaf89);
                            break;

                    }
            }
        }


    }

}
Main.java:

Java:
package sample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception{
        Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
        primaryStage.setTitle("GS-G Leitungstest");
        primaryStage.setScene(new Scene(root, 1000, 750));
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
sample.fxml:


XML:
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.ProgressBar?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.TreeView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>
<?fxml version="1.0" encoding="UTF-8"?>

<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Controller">
    <center>
        <TabPane prefHeight="200.0" prefWidth="200.0" tabClosingPolicy="UNAVAILABLE" BorderPane.alignment="CENTER">
            <tabs>
                <Tab fx:id="dgp" text="Durchgangsprüfung">
                    <content>
                        <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
                            <children>
                                <ListView prefHeight="371.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
                            </children>
                        </AnchorPane>
                    </content>
                </Tab>
                <Tab fx:id="fs" text="Fehlersuche">
                    <content>
                        <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
                            <children>
                                <ListView prefHeight="371.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
                            </children>
                        </AnchorPane>
                    </content>
                </Tab>
                <Tab fx:id="hck" text="HC Kreis">
                    <content>
                        <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
                            <children>
                                <ListView prefHeight="371.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
                            </children>
                        </AnchorPane>
                    </content>
                </Tab>
            </tabs>
        </TabPane>
    </center>
    <right>
        <ListView fx:id="fehlerproto" prefWidth="250.0" BorderPane.alignment="CENTER" />
    </right>
    <bottom>
        <HBox alignment="CENTER" BorderPane.alignment="CENTER">
            <children>
                <Label fx:id="label" text="Prüfstatus:" />
                <ProgressBar fx:id="ladebalken" prefWidth="200.0" progress="0.0" />
                <Text fx:id="prüfstatusAnzeige" strokeType="OUTSIDE" strokeWidth="0.0" text="Status" />
            <RadioButton fx:id="dummy" mnemonicParsing="false" text="Kontakt" />
            </children>
        </HBox>
    </bottom>
   <left>
      <VBox alignment="CENTER" prefHeight="200.0" prefWidth="250.0" BorderPane.alignment="CENTER">
         <children>
            <Label fx:id="labelSl" prefHeight="17.0" prefWidth="86.0" text="Steckerliste:" underline="true" />
            <TextField fx:id="suchen" minHeight="-Infinity" prefHeight="30.0" prefWidth="250.0" promptText="Suchen" VBox.vgrow="ALWAYS" />
            <TreeView fx:id="steckertreeview" onContextMenuRequested="#mouseClick" onMouseClicked="#mouseClick" VBox.vgrow="ALWAYS" />
         </children>
      </VBox>
   </left>
</BorderPane>
Fehlercode:

Java:
"C:\Program Files\Java\jdk1.8.0_221\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.2\lib\idea_rt.jar=57159:C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_221\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\rt.jar;C:\Users\kjsch\IdeaProjects\FXML-GS-G Leitungstest\out\production\FXML-GS-G Leitungstest;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\activation-1.1.1.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\commons-collections4-4.3.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\commons-codec-1.12.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\commons-compress-1.18.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\commons-logging-1.2.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\commons-math3-3.6.1.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\curvesapi-1.06.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\jaxb-api-2.3.0.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\jaxb-core-2.3.0.1.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\jaxb-impl-2.3.0.1.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\junit-4.12.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\log4j-1.2.17.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\poi-4.1.0.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\poi-examples-4.1.0.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\poi-excelant-4.1.0.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\poi-ooxml-4.1.0.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\poi-ooxml-schemas-4.1.0.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\poi-scratchpad-4.1.0.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\xmlbeans-3.1.0.jar" sample.Main
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1774)
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3470)
    at javafx.scene.Scene$ClickGenerator.access$8100(Scene.java:3398)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3766)
    at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:432)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:410)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
    at com.sun.glass.ui.View.notifyMouse(View.java:937)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$3(WinApplication.java:177)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
    at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771)
    ... 31 more
Caused by: java.lang.NullPointerException
    at sample.Controller.mouseClick(Controller.java:72)
    ... 41 more

Process finished with exit code 0
 
K

kneitzel

Das wichtige ist der Teil der Exception:
Code:
Caused by: java.lang.NullPointerException
    at sample.Controller.mouseClick(Controller.java:72)
Also schau in deiner Controller.java Datei, Zeile 72. Da bekommst Du die Null Pointer Exception.

(Ich habe versucht, das mit dem geposteten Code zu finden, aber das scheint nicht ganz erfolgreich gewesen zu sein. denn Zeile 72 wäre da wohl try(FileInputStream excelFile =new FileInputStream(new File (hilfsString))) { und da würde ich keine NPE erwarten, denn hilfsString ist nicht null und die Konstruktoren liefern entweder eine Instanz oder werfen eine andere Exception (z.B. IOException, FileNotFoundException und so) ....)
 
Am Ende wird mir der Inhalt der Excel Tabelle ausgegeben, jedoch mit der NullPionterException.
Diese Fehler werden mir beim öffnen eines Zweiges einer TreeView geworfen. Es wurden hier nun 2 Zweige geöffnet und am Ende der Inhalt der Excel-Datei mit dem Anhang java.lang.NullPointerException ausgegeben.

Java:
"C:\Program Files\Java\jdk1.8.0_221\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.2\lib\idea_rt.jar=58859:C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_221\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_221\jre\lib\rt.jar;C:\Users\kjsch\IdeaProjects\FXML-GS-G Leitungstest\out\production\FXML-GS-G Leitungstest;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\activation-1.1.1.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\commons-collections4-4.3.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\commons-codec-1.12.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\commons-compress-1.18.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\commons-logging-1.2.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\commons-math3-3.6.1.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\curvesapi-1.06.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\jaxb-api-2.3.0.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\jaxb-core-2.3.0.1.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\jaxb-impl-2.3.0.1.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\junit-4.12.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\log4j-1.2.17.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\poi-4.1.0.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\poi-examples-4.1.0.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\poi-excelant-4.1.0.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\poi-ooxml-4.1.0.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\poi-ooxml-schemas-4.1.0.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\poi-scratchpad-4.1.0.jar;C:\Users\kjsch\IdeaProjects\poi-4.1.0\lib\xmlbeans-3.1.0.jar" sample.Main
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1774)
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3470)
    at javafx.scene.Scene$ClickGenerator.access$8100(Scene.java:3398)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3766)
    at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:432)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:410)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
    at com.sun.glass.ui.View.notifyMouse(View.java:937)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$3(WinApplication.java:177)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
    at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771)
    ... 31 more
Caused by: java.lang.NullPointerException
    at sample.Controller.mouseClick(Controller.java:70)
    ... 41 more
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1774)
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3470)
    at javafx.scene.Scene$ClickGenerator.access$8100(Scene.java:3398)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3766)
    at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:432)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:410)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
    at com.sun.glass.ui.View.notifyMouse(View.java:937)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$3(WinApplication.java:177)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
    at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771)
    ... 31 more
Caused by: java.lang.NullPointerException
    at sample.Controller.mouseClick(Controller.java:70)
    ... 41 more
mir
geht es
gut
java.lang.NullPointerException
Process finished with exit code 0
 
Die NullPointerException wurde nun gelöst.

Das Problem lag in dieser Zeile:
Java:
TreeItem<String> itemMouse = steckertreeview.getSelectionModel().getSelectedItem();
Beim Klicken auf den Pfeil der TreeView, wurde null übergeben anstatt ein String.
Lösung:
Java:
if(steckertreeview.getSelectionModel().getSelectedItem() != null) {
            TreeItem<String> itemMouse = steckertreeview.getSelectionModel().getSelectedItem();
Trotzdem danke für die Hilfe.
 
Passende Stellenanzeigen aus deiner Region:

Neue Themen

Oben