Hello, I really hopeless and I feel like this is my last chance to fix that, before I will have to send this to my teacher.
I'm getting this error:
Exception in thread "main" java.lang.NullPointerException
at ui.PanelBatohu.<init>(PanelBatohu.java:33)
at ui.Gui.init(Gui.java:107)
at ui.Gui.<init>(Gui.java:68)
at main.Start.main(Start.java:25)
Legend: Doing graphic interface for this one little java game.
Batoh= Bag(container in game)
zaregistruj pozorovatele(register observer)
first error line is:
[30] public PanelBatohu(Batoh batoh) {
[31] super();
[32] this.batoh = batoh;
[33] batoh.zaregistrujPozorovatele(this);
[34] this.aktualizuj(batoh);
[35]
[36] this.setBorder(BorderFactory.createTitledBorder("V ěci v batohu:"));
[37] this.setVisible(true);
}
second error line is:
[107]panelBatohu = new PanelBatohu(hra.getBatoh());
[108] hlavniOknoFrame.add(panelBatohu, BorderLayout.WEST);[LIST=1]
third error line:
[65]public Gui(Hra hra) {
[66] this.hra = hra;
[67] initMenu();
[68] init();
fourth error line:
[23]public static void main(String[] args) {
[24] if (args.length == 0) {
[25] Gui grafika = new Gui(new Hra());