Kezdőoldal » Számítástechnika » Programozás » A kérdésem a következő: Java...

Domper93 kérdése:

A kérdésem a következő: Java nyelvben grafikus felületnél, van egy snakes programom ami tökéletesen lefut semmi hibát nem kap, de mégsem jeleníti meg magát a játékot grafikusan. Mi lehet a probléma?

Figyelt kérdés

2013. dec. 23. 21:51
 1/7 anonim ***** válasza:
100%
Sok minden lehet a probléma.
2013. dec. 23. 22:06
Hasznos számodra ez a válasz?
 2/7 anonim ***** válasza:
Ha látnánk a kódot az sokat segítene. :D
2013. dec. 24. 10:45
Hasznos számodra ez a válasz?
 3/7 A kérdező kommentje:
Kozben megoldottam, nem epp ahogy akartam de megjelenik mostmar. kosz azert
2013. dec. 25. 14:07
 4/7 A kérdező kommentje:

Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException

at snake.snakeCanvas.DrawFruit(snakeCanvas.java:239)

at snake.snakeCanvas.paint(snakeCanvas.java:77)

at sun.awt.RepaintArea.paintComponent(RepaintArea.java:264)

at sun.awt.RepaintArea.paint(RepaintArea.java:240)

at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:348)

at java.awt.Component.dispatchEventImpl(Component.java:4954)

at java.awt.Component.dispatchEvent(Component.java:4700)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:743)

at java.awt.EventQueue.access$400(EventQueue.java:97)

at java.awt.EventQueue$3.run(EventQueue.java:694)

at java.awt.EventQueue$3.run(EventQueue.java:691)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)

at java.awt.EventQueue$4.run(EventQueue.java:716)

at java.awt.EventQueue$4.run(EventQueue.java:714)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:713)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:220)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:135)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:123)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:119)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:111)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException

at snake.snakeCanvas.DrawFruit(snakeCanvas.java:239)

at snake.snakeCanvas.paint(snakeCanvas.java:77)

at sun.awt.RepaintArea.paintComponent(RepaintArea.java:264)

at sun.awt.RepaintArea.paint(RepaintArea.java:240)

at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:348)

at java.awt.Component.dispatchEventImpl(Component.java:4954)

at java.awt.Component.dispatchEvent(Component.java:4700)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:743)

at java.awt.EventQueue.access$400(EventQueue.java:97)

at java.awt.EventQueue$3.run(EventQueue.java:694)

at java.awt.EventQueue$3.run(EventQueue.java:691)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)

at java.awt.EventQueue$4.run(EventQueue.java:716)

at java.awt.EventQueue$4.run(EventQueue.java:714)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:713)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:220)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:135)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:123)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:119)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:111)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException

at snake.snakeCanvas.DrawFruit(snakeCanvas.java:239)

at snake.snakeCanvas.paint(snakeCanvas.java:77)

at snake.snakeCanvas.update(snakeCanvas.java:112)

at sun.awt.RepaintArea.updateComponent(RepaintArea.java:255)

at sun.awt.RepaintArea.paint(RepaintArea.java:232)

at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:348)

at java.awt.Component.dispatchEventImpl(Component.java:4954)

at java.awt.Component.dispatchEvent(Component.java:4700)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:743)

at java.awt.EventQueue.access$400(EventQueue.java:97)

at java.awt.EventQueue$3.run(EventQueue.java:694)

at java.awt.EventQueue$3.run(EventQueue.java:691)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)

at java.awt.EventQueue$4.run(EventQueue.java:716)

at java.awt.EventQueue$4.run(EventQueue.java:714)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:713)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:220)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:135)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:123)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:119)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:111)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException

at snake.snakeCanvas.DrawFruit(snakeCanvas.java:239)

at snake.snakeCanvas.paint(snakeCanvas.java:77)

at snake.snakeCanvas.update(snakeCanvas.java:112)

at sun.awt.RepaintArea.updateComponent(RepaintArea.java:255)

at sun.awt.RepaintArea.paint(RepaintArea.java:232)

at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:348)

at java.awt.Component.dispatchEventImpl(Component.java:4954)

at java.awt.Component.dispatchEvent(Component.java:4700)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:743)

at java.awt.EventQueue.access$400(EventQueue.java:97)

at java.awt.EventQueue$3.run(EventQueue.java:694)

at java.awt.EventQueue$3.run(EventQueue.java:691)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)

at java.awt.EventQueue$4.run(EventQueue.java:716)

at java.awt.EventQueue$4.run(EventQueue.java:714)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:713)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:220)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:135)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:123)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:119)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:111)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException

at snake.snakeCanvas.DrawFruit(snakeCanvas.java:239)

at snake.snakeCanvas.paint(snakeCanvas.java:77)

at snake.snakeCanvas.update(snakeCanvas.java:112)

at sun.awt.RepaintArea.updateComponent(RepaintArea.java:255)

at sun.awt.RepaintArea.paint(RepaintArea.java:232)

at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:348)

at java.awt.Component.dispatchEventImpl(Component.java:4954)

at java.awt.Component.dispatchEvent(Component.java:4700)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:743)

at java.awt.EventQueue.access$400(EventQueue.java:97)

at java.awt.EventQueue$3.run(EventQueue.java:694)

at java.awt.EventQueue$3.run(EventQueue.java:691)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)

at java.awt.EventQueue$4.run(EventQueue.java:716)

at java.awt.EventQueue$4.run(EventQueue.java:714)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:713)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:220)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:135)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:123)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:119)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:111)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException

at snake.snakeCanvas.DrawFruit(snakeCanvas.java:239)

at snake.snakeCanvas.paint(snakeCanvas.java:77)

at snake.snakeCanvas.update(snakeCanvas.java:112)

at sun.awt.RepaintArea.updateComponent(RepaintArea.java:255)

at sun.awt.RepaintArea.paint(RepaintArea.java:232)

at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:348)

at java.awt.Component.dispatchEventImpl(Component.java:4954)

at java.awt.Component.dispatchEvent(Component.java:4700)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:743)

at java.awt.EventQueue.access$400(EventQueue.java:97)

at java.awt.EventQueue$3.run(EventQueue.java:694)

at java.awt.EventQueue$3.run(EventQueue.java:691)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)

at java.awt.EventQueue$4.run(EventQueue.java:716)

at java.awt.EventQueue$4.run(EventQueue.java:714)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:713)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:220)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:135)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:123)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:119)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:111)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException

at snake.snakeCanvas.DrawFruit(snakeCanvas.java:239)

at snake.snakeCanvas.paint(snakeCanvas.java:77)

at snake.snakeCanvas.update(snakeCanvas.java:112)

at sun.awt.RepaintArea.updateComponent(RepaintArea.java:255)

at sun.awt.RepaintArea.paint(RepaintArea.java:232)

at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:348)

at java.awt.Component.dispatchEventImpl(Component.java:4954)

at java.awt.Component.dispatchEvent(Component.java:4700)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:743)

at java.awt.EventQueue.access$400(EventQueue.java:97)

at java.awt.EventQueue$3.run(EventQueue.java:694)

at java.awt.EventQueue$3.run(EventQueue.java:691)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)

at java.awt.EventQueue$4.run(EventQueue.java:716)

at java.awt.EventQueue$4.run(EventQueue.java:714)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:713)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:220)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:135)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:123)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:119)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:111)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException

at snake.snakeCanvas.DrawFruit(snakeCanvas.java:239)

at snake.snakeCanvas.paint(snakeCanvas.java:77)

at snake.snakeCanvas.update(snakeCanvas.java:112)

at sun.awt.RepaintArea.updateComponent(RepaintArea.java:255)

at sun.awt.RepaintArea.paint(RepaintArea.java:232)

at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:348)

at java.awt.Component.dispatchEventImpl(Component.java:4954)

at java.awt.Component.dispatchEvent(Component.java:4700)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:743)

at java.awt.EventQueue.access$400(EventQueue.java:97)

at java.awt.EventQueue$3.run(EventQueue.java:694)

at java.awt.EventQueue$3.run(EventQueue.java:691)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)

at java.awt.EventQueue$4.run(EventQueue.java:716)

at java.awt.EventQueue$4.run(EventQueue.java:714)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:713)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:220)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:135)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:123)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:119)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:111)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

2013. dec. 29. 18:00
 5/7 anonim ***** válasza:
Hát ez tök hasznos. Minden, csak nem kód.
2013. dec. 29. 18:08
Hasznos számodra ez a válasz?
 6/7 A kérdező kommentje:

Bocsanat, azok a hibak voltak amiket ki ir mind, de ezt nem ertem mert irja Exception in thread "Thread-3" Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException


Ja es hogy lehet egy kepet be ''importalni'' mert nekem olyan opcio nincsen>?????

2013. dec. 30. 01:06
 7/7 anonim ***** válasza:

Képet beolvasni egy fájlból a javax.imageio.ImageIO.read(File) metódussal tudsz.


A NullPointerException azt jelenti, hogy egy null értékű változón próbáltál elérni egy metódust, változót, ....

Ez a snakeCanvas osztály 239. sorában történt meg. Ha a kódot bemásolod segítünk.


Jó tanács:

Az osztályneveket nagy, a metódusokét kis betűvel kezd.

Ne csinálj óriási osztályokat, bontsd részekre (a 239 sor soknak tűnik). Így egyszerűbb a hibakeresés, könnyebb módosítani, és "biztonságosabb".

2014. jan. 11. 22:04
Hasznos számodra ez a válasz?

Kapcsolódó kérdések:




Minden jog fenntartva © 2024, www.gyakorikerdesek.hu
GYIK | Szabályzat | Jogi nyilatkozat | Adatvédelem | Cookie beállítások | WebMinute Kft. | Facebook | Kapcsolat: info(kukac)gyakorikerdesek.hu

A weboldalon megjelenő anyagok nem minősülnek szerkesztői tartalomnak, előzetes ellenőrzésen nem esnek át, az üzemeltető véleményét nem tükrözik.
Ha kifogással szeretne élni valamely tartalommal kapcsolatban, kérjük jelezze e-mailes elérhetőségünkön!