Help Gioco JAVA
#1
Inviato 24 settembre 2012 - 14:10
il gioco funziona bene l'unica cosa è che mi da come output di netbeans innumerevole eccezioni ..scaturite da questa linea di codice :
@Override
public void mouseMoved(java.awt.event.MouseEvent evt) {
if (((firtsFrontCard != null && secondFrontCard != null)) && (firtsFrontCard.getId() != secondFrontCard.getId()))
..........
l'errore è il seguente :
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at Game.LogicGame$2.mouseClicked(LogicGame.java:194)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEvent Multicaster.java:270)
at java.awt.Component.processMouseEvent(Component.jav a:6508)
at javax.swing.JComponent.processMouseEvent(JComponen t.java:3321)
at java.awt.Component.processEvent(Component.java:627 0)
at java.awt.Container.processEvent(Container.java:222 9)
at java.awt.Component.dispatchEventImpl(Component.jav a:4861)
at java.awt.Container.dispatchEventImpl(Container.jav a:2287)
at java.awt.Component.dispatchEvent(Component.java:46 87)
at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:4501)
at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:4422)
at java.awt.Container.dispatchEventImpl(Container.jav a:2273)
at java.awt.window.dispatchEventImpl(window.java:2719 )
at java.awt.Component.dispatchEvent(Component.java:46 87)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.j ava:703)
at java.awt.EventQueue.access$000(EventQueue.java:102 )
at java.awt.EventQueue$3.run(EventQueue.java:662)
at java.awt.EventQueue$3.run(EventQueue.java:660)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:676)
at java.awt.EventQueue$4.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 673)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:97)
e lo ripete per 3 volte nell'output..come posso risolvere ???
se vi servono altre info contattatemi ciaoooo grazie in anticipo
#2
Inviato 24 settembre 2012 - 14:24
Dat
#3 Guest_ally_*
Inviato 24 settembre 2012 - 14:27
#4
Inviato 24 settembre 2012 - 14:36
FIRMA FOTTUTAMENTE EDITATA. IL FOTTUTO STAFF.
Mai più giorni felici
#6
Inviato 24 settembre 2012 - 15:40
Un giorno ho visto per strada un tizio barcollante , sporco, pieno di chiazze verdi e pus, infastidiva bambine e rubava i soldi alle vecchiette: era uno che postava nel DS.
ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้
#7 Guest_ally_*
Inviato 24 settembre 2012 - 15:46
mi stai antipatico, non ti rispondo
...le matti risate...
#8
Inviato 24 settembre 2012 - 15:55
...le matti risate...
Un giorno ho visto per strada un tizio barcollante , sporco, pieno di chiazze verdi e pus, infastidiva bambine e rubava i soldi alle vecchiette: era uno che postava nel DS.
ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้
#9
Inviato 24 settembre 2012 - 16:03
Il sole è giallo
Brava Giovanna, brava
E canto please don't let me be misunderstood mentre parcheggio nel parcheggio l'alfasud
#10
Inviato 27 settembre 2012 - 09:11
Messaggio modificato da Miky_Many il 27 settembre 2012 - 09:11
#12
Inviato 27 settembre 2012 - 09:25
I'm a man too brave to follow history...
#13
Inviato 27 settembre 2012 - 09:39
Dat
#14
Inviato 27 settembre 2012 - 10:12
Compila XD è un errore a run-tine ..e cmq l'avv capito che è un errore di confronto ..ma cm si risolve ?? vi ho messo anche la linea da dv parte l'errore XD
Un giorno ho visto per strada un tizio barcollante , sporco, pieno di chiazze verdi e pus, infastidiva bambine e rubava i soldi alle vecchiette: era uno che postava nel DS.
ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้ก็็็็็็็็็็็็็็็็็็็็ กิิิิิิิิิิิิิิิิิิิิ ก้้้้้้้้้้้้้้้้้้้้
#15
Inviato 27 settembre 2012 - 10:26
I'm a man too brave to follow history...
#16
Inviato 27 settembre 2012 - 10:49
if (((firtsFrontCard != null && secondFrontCard != null)) && (firtsFrontCard.getId() != secondFrontCard.getId()))
se firstFrontCard è null, come fai a richiamare il metodo firtsFrontCard.getId() ? Stai chiamando un metodo su un oggetto null.
Questa va riscritta come:
if (firtsFrontCard != null && secondFrontCard != null) if (firtsFrontCard.getId() != secondFrontCard.getId())
Messaggio modificato da yorkeiser il 27 settembre 2012 - 10:51
Il sole è giallo
Brava Giovanna, brava
E canto please don't let me be misunderstood mentre parcheggio nel parcheggio l'alfasud
#17
Inviato 27 settembre 2012 - 11:35
if (((firtsFrontCard != null && secondFrontCard != null)) && (firtsFrontCard.getId() != secondFrontCard.getId()))
hai scritto firts al posto di first
El sueño de la razón produce monstruos
#18
Inviato 27 settembre 2012 - 12:24
a && b : se a è 0 b non viene valutato
a || b : se a è 1 b non viene valutato
FIRMA FOTTUTAMENTE EDITATA. IL FOTTUTO STAFF.
Mai più giorni felici
#19
Inviato 27 settembre 2012 - 13:07
comunque guardate che
a && b : se a è 0 b non viene valutato
a || b : se a è 1 b non viene valutato
Non è una regola, dipende dai compilatori.
Effettivamente Java mi pare di ricordare si comporti come hai detto, ma non vedo altre cose che possano essere null in quella istruzione.
Il sole è giallo
Brava Giovanna, brava
E canto please don't let me be misunderstood mentre parcheggio nel parcheggio l'alfasud
#20
Inviato 27 settembre 2012 - 14:10
FIRMA FOTTUTAMENTE EDITATA. IL FOTTUTO STAFF.
Mai più giorni felici