Programmieren - alles kontrollieren 4.934 Themen, 20.613 Beiträge

event dispatching nullpointerexception

Palladio / 1 Antworten / Flachansicht Nickles

Hallo!
Beim Ausführen der folgenden Methode erhalte ich immer die untenstehende Fehlermeldung, das Löschen der mit dem Index verbundenen Datei funktioniert allerdings. Hat jemand eine Idee, woran das liegen könnte?

Danke


public void loeschen()
{
try
{

int a =view.lst.getSelectedIndex();

System.out.println(a);
File fil =new File("Eingaenge"+"\\\\"+a+".txt" );
fil.delete();

}catch(Exception ex){}

}






Exception occurred during event dispatching:
java.lang.NullPointerException
at MailController.actionPerformed(MailJava.java:478)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)
at javax.swing.AbstractButton.doClick(AbstractButton.java:279)
at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:886)
at java.awt.Component.processMouseEvent(Component.java:3717)
at java.awt.Component.processEvent(Component.java:3546)
at java.awt.Container.processEvent(Container.java:1167)
at java.awt.Component.dispatchEventImpl(Component.java:2595)
at java.awt.Container.dispatchEventImpl(Container.java:1216)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2458)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2223)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2132)
at java.awt.Container.dispatchEventImpl(Container.java:1203)
at java.awt.Window.dispatchEventImpl(Window.java:918)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:336)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:134)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:96)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:88)

bei Antwort benachrichtigen