Salut !
j'ai un probleme
j'essai d'utiliser le tray dans mon application
mais au lancement j'ai cette erreur :
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
at ScreenFrame.formComponentShown(ScreenFrame.java:114)
at ScreenFrame.access$000(ScreenFrame.java:18)
at ScreenFrame$1.componentShown(ScreenFrame.java:45)
at java.awt.Component.processComponentEvent(Component.java:5320)
at java.awt.Component.processEvent(Component.java:5268)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Window.processEvent(Window.java:1161)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Voila le bout de code qui contient le tray , je vient de le commencer :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
    private void formComponentShown(java.awt.event.ComponentEvent evt) {
        ImageIcon IconeVerte = new ImageIcon(getClass().getResource("IconGreen.gif"));
        ImageIcon IconeJaune = new ImageIcon(getClass().getResource("IconYellow.gif"));
        ImageIcon IconeRouge = new ImageIcon(getClass().getResource("IconRed.gif"));
        SystemTray allTray = SystemTray.getDefaultSystemTray();
        TrayIcon Tray1 = new TrayIcon(IconeRouge,"Test");
        Tray1.setIconAutoSize(true);
    }
que faire ?
merci