"AWT-EventQueue-0" java.lang.NullPointer

Fermé
nanou - 18 juin 2008 à 05:13
alexdelareunion Messages postés 545 Date d'inscription dimanche 18 mars 2007 Statut Membre Dernière intervention 9 octobre 2023 - 18 juin 2008 à 06:17
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!!!

1 réponse

alexdelareunion Messages postés 545 Date d'inscription dimanche 18 mars 2007 Statut Membre Dernière intervention 9 octobre 2023 142
18 juin 2008 à 06:17
C'est surement dans
at BudgetLink_View.TestingForm.jComboBox2ActionPerformed(TestingForm.java:648)

Je ne comrends pas bien tous les contrôles que tu fais dans ton Evenement, ça me semble étrange
2