dabidabi
Messages postés21Date d'inscriptionmardi 3 mai 2011StatutMembreDernière intervention 2 août 2011
-
18 juil. 2011 à 22:15
cs_Julien39
Messages postés6414Date d'inscriptionmardi 8 mars 2005StatutModérateurDernière intervention29 juillet 2020
-
25 juil. 2011 à 08:40
Bonsoir, voila j'aimerai comparer deux variables de type string, pour cela j'ai utilisé la fonction equals. le probleme c'est que si les deux variables sont egaux il fait le traitement normalement sino il affiche une exeption..j sai pa comment résoudre ça...si quelq'un peut m'aider...merci bien
if(app.equals(login)){
envoi=true;
}
else{
jOptionPane3.showMessageDialog(jDialog3, "votre login est incorrect");
}
voila l'exeption k'il affiche:
(la ligne 576correspand a la ligne d code de la comparaison)
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
at Travail.actionPerformed(Travail.java:576)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
A voir également:
Comparer deux string java
Comparer deux chaine de caractere en java - Meilleures réponses