Witam !
Mam problem z timerem. Mam klase MyTimer która dziedziczy po klasie TimerTask.
Tworze timer w ten sposób:
Timer timer1 = new Timer()
MyTimer timerTask = new MyTimer();
W konstruktorze okna gry odpalam go za pomoca tej instrukcji:
timer1.schedule(timerTask,0,100)
Po załaczeniu programu wyskakuje mi bład w funkcji run() klasy MyTimer, w linijce w której wywołuje repaint().
Oto ten bład:
Exception in thread "Timer-0" java.lang.NullPointerException
at MyTimer.run(MyTimer.java:20)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
Czym to może być spowodowane?