Accueil > Forum > > > > Action sur un combobox et Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
Action sur un combobox et Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
mercredi 18 juin 2008 à 04:16:47 |
Action sur un combobox et Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

radmanolf
|
salut
Bon moi j ai un gros probleme et j ai vraiment besoin de votre aide donc j ai deux combobox dans la premiere j ai des services et dans la deuxieme j ai les debits utilisés pour ces services il faut que quand je fixe le service "voice" dans le 1er combobox le 2eme combobox affiche seulement le débit "12.2" et devient disabled . Pour ça j ai écris un code qui a fonctionné:
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: int modifiers; if (evt instanceof ActionEvent) { modifiers = ((ActionEvent)evt).getModifiers(); long modsLong = modifiers & ActionEvent.MOUSE_EVENT_MASK; if (modsLong == MouseEvent.BUTTON1_MASK) { // System.out.println(this.jComboBox1.getItemAt(this.jComboBox1.getSelectedIndex()).toString()); if(this.jComboBox1.getItemAt(this.jComboBox1.getSelectedIndex()).toString().equalsIgnoreCase("voice")){ this.jComboBox2.removeAllItems(); this.jComboBox2.addItem("12.2"); this.jComboBox2.setEnabled(false); }else GetServicesRate(); } }
mais seulement au début maintenant quand je sélectionne voice dans le combobox1 il n'affiche plus rien dans le combobox2 et l affichage devient bizare et quand j essaye de selectionner un autre service l affichage ne change pas et le combobox2 reste aussi vide.
et l'exception suivante apparait: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:991) at java.lang.Double.parseDouble(Double.java:510) at BudgetLink_View.TestingForm.jComboBox2ActionPerformed(TestingForm.java:648) at BudgetLink_View.TestingForm.access$100(TestingForm.java:22) at BudgetLink_View.TestingForm$2.actionPerformed(TestingForm.java:143) at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1242) at javax.swing.JComboBox.contentsChanged(JComboBox.java:1313) at javax.swing.JComboBox.intervalRemoved(JComboBox.java:1333) at javax.swing.AbstractListModel.fireIntervalRemoved(AbstractListModel.java:161) at javax.swing.DefaultComboBoxModel.removeAllElements(DefaultComboBoxModel.java:169) at javax.swing.JComboBox.removeAllItems(JComboBox.java:753) at BudgetLink_View.TestingForm.GetServicesRate(TestingForm.java:710) at BudgetLink_View.TestingForm.jComboBox1ActionPerformed(TestingForm.java:607) at BudgetLink_View.TestingForm.access$000(TestingForm.java:22) at BudgetLink_View.TestingForm$1.actionPerformed(TestingForm.java:134) at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1242) at javax.swing.JComboBox.setSelectedItem(JComboBox.java:569) at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:605) at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(BasicComboPopup.java:814) at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273) at java.awt.Component.processMouseEvent(Component.java:6038) at javax.swing.JComponent.processMouseEvent(JComponent.java:3260) at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(BasicComboPopup.java:480) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) at java.awt.Container.dispatchEventImpl(Container.java:2102) at java.awt.Window.dispatchEventImpl(Window.java:2429) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Merci pour votre aide c tres urgent!!!
|
|
mercredi 18 juin 2008 à 10:53:04 |
Re : Action sur un combobox et Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

jojolemariole
|
Salut,
Merci pour la stack trace :
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:991) at java.lang.Double.parseDouble(Double.java:510) at BudgetLink_View.TestingForm.jComboBox2ActionPerformed(TestingForm.java:648) at BudgetLink_View.TestingForm.access$100(TestingForm.java:22) at BudgetLink_View.TestingForm$2.actionPerformed(TestingForm.java:143) at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1242) at javax.swing.JComboBox.contentsChanged(JComboBox.java:1313) at javax.swing.JComboBox.intervalRemoved(JComboBox.java:1333) at javax.swing.AbstractListModel.fireIntervalRemoved(AbstractListModel.java:161) at javax.swing.DefaultComboBoxModel.removeAllElements(DefaultComboBoxModel.java:169) at javax.swing.JComboBox.removeAllItems(JComboBox.java:753) at BudgetLink_View.TestingForm.GetServicesRate(TestingForm.java:710) at BudgetLink_View.TestingForm.jComboBox1ActionPerformed(TestingForm.java:607) at BudgetLink_View.TestingForm.access$000(TestingForm.java:22) at BudgetLink_View.TestingForm$1.actionPerformed(TestingForm.java:134) at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1242) at javax.swing.JComboBox.setSelectedItem(JComboBox.java:569) at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:605) at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(BasicComboPopup.java:814) at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273) at java.awt.Component.processMouseEvent(Component.java:6038) at javax.swing.JComponent.processMouseEvent(JComponent.java:3260) at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(BasicComboPopup.java:480) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) at java.awt.Container.dispatchEventImpl(Container.java:2102) at java.awt.Window.dispatchEventImpl(Window.java:2429) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Cette pile retrace tous les appels de fonction, le dernier appel de fonction exécuté étant situé en haut de la pile, (c'est le principe d'une pile).
Je t'ai mis en violet, ce qui se passait dans les librairies Java, et en bleu ce qui se passe dans tes librairies.
D'abord on voit que tu déclenches un évènement, sans doute quand tu sélectionnes un item dans ta première comboBox. Tu passes donc par jComboBox1ActionPerformed, ensuite tu appelles GetServicesRate. Ce qui signifie, d'après ton code que tu n'as pas sélectionné "voice". La méthode GetServicesRate appelle removeAllElements sur ton deuxième comboBox apparemment. Et suite à ce vidage de ton deuxième combobox, on arrive dans l'écouteur : jComboBox2ActionPerformed, lequel a appelé parseDouble sur une chaîne de caractères. Dis-nous juste quelle chaîne de caractère tu vas lire dans jComboBox2ActionPerformedet on pourra te dire ce qui cloche.
|
|
Cette discussion est classée dans : java, awt, jcombobox, at, testingform
Répondre à ce message
Sujets en rapport avec ce message
Rmi et Jnlp [ par homersimp ]
Mon but est de réaliser une applet dans un fichier jnlp, qui devrait se connecter à une servlet sur serveur(avec exemple de DaytimeServer et applet.Si
Probleme pour le copier coller en java [ par Frouf85 ]
Bonjour bonjour...Si vous vouliez bien me venir en aide, ca serait sympa!En fait mon copier/coller ne marche pas.Voila mon code:import java.awt.datatr
Probleme d'affichage d'une applet [ par juanpipo ]
Voila le message d'erreur qui s'affiche:java.awt.AWTError: BoxLayout can't be shared at javax.swing.BoxLayout.checkContainer(BoxLayout.java:342) at ja
BackBuffer - NullPointerException [ par Pascmar ]
Bonjour, j'ai un problème avec l'utilisation d'un "backBuffer" pour améliorer le rendu d'affichage d'une application. Le lien suivant est un exemple d
Pb avec une applet [ par rubo ]
Salut a tous,j'ai réalisé ( enfin g participé a la realisation) une applet upload. elle est signé est tt.Mais elle ne fonctionne po g cette erreurExc
pb affichage d'une image dans un JPanel [ par mallox ]
Bonjour à tous,J'ai une erreur à l'execution de mon application qui affiche une image dans un JPanel. L'image s'affiche qd meme mais une erreur est le
Problème avec une fonction java [ par Bouki ]
Salut,g un pb avec java, je veux demander une question avec oui ou non comme unique choix g donc fe ca :int Ok = JOptionPane.showConfirmDialog(null, "
problème de transmission de variable entre classe [ par kelu28 ]
voila je suis en train de développer un petit logiciel qui gère des cartes d'acquisution. mon truc marchais sans interface graphique et j'ai voullu ra
URGENT ! Problème événements ! PEASE ! [ par ellandebasque ]
Bonjour, j'ai des exceptions qui aparaissent et je ne sais pas pourquoi, je les ai. J'explique en détail :Voici des brides de mon code :// TypesJPanel
Problème d'événements [ par ellandebasque ]
Bonjour,je développe une application (logique). J'ai créé des boutons, des menus. Je leur ai rattaché des événements. Le problème est que certains (le
Livres en rapport
|
Derniers Blogs
SLIDE & DéMO TECHDAYS 2012 - FAST & FURIOUS XAML APPSSLIDE & DéMO TECHDAYS 2012 - FAST & FURIOUS XAML APPS par Vko
Retrouvez les slides et les démo de ma session Fast & Furious XAML Apps. A ceux qui se posent la question : "est-ce que le code de la DataGrid est disponible?", je vous répondrais "pas encore". Je vais mettre en place un projet codeplex pour part...
Cliquez pour lire la suite de l'article par Vko XNA IS DEAD!XNA IS DEAD! par richardc
Depuis la semaine dernière (et grâce aux TechDays 2012), je me penche activement sur la nouvelle version de Windows, aka Windows 8. Vous me direz, il était temps puisque la première preview date de Septembre dernier.
OK. Remarquez, on n'en est qu'aux...
Cliquez pour lire la suite de l'article par richardc TECHDAYS PARIS 2012 : WINDOWS SERVER "8" QUOI DE 9 !TECHDAYS PARIS 2012 : WINDOWS SERVER "8" QUOI DE 9 ! par ROMELARD Fabrice
Speakers: Fabrice Meillon et Stanislas Quastana Cette session est basée entièrement sur celle donnée lors de la BUILD cet hiver. Il n'y a pas d'ajout d'information en rapport avec cet évènement passé. Windows 8 Server sera intégralem...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice [HTML5] AUTOUR DU W3C : NOUVEAUX STANDARDS ET WEB MOBILE (LILLE)[HTML5] AUTOUR DU W3C : NOUVEAUX STANDARDS ET WEB MOBILE (LILLE) par Gio
Je m'y prends un peu tard je sais, mais bon je suis développeur web et donc hyper fainéant ! Toujours dans le cadre des technologies émergentes, ici HTML5, parce qu'on aime HTML5 chez Wyg , nous seront présent, le vieux ( Aurélien V.) et moi, pour pr...
Cliquez pour lire la suite de l'article par Gio
Logiciels
DocTranslate (V3.1.0.0)DOCTRANSLATE (V3.1.0.0)DocTranslate est un traducteur de document Microsoft Word, PowerPoint et Excel. Il permet d'autom... Cliquez pour télécharger DocTranslate Tribler (2012)TRIBLER (2012)Tribler est un client pair à pair (P2P/Peer-to-Peer) open source avec la capacité de regarder des... Cliquez pour télécharger Tribler OneSwarm (2012)ONESWARM (2012)Le peer-to-peer qui protège votre vie privée, c'est OneSwarm.
Ce logiciel de peer-to-peer crypté... Cliquez pour télécharger OneSwarm PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System
|