Lorsque le splashscreen (qui est un JDialog) se ferme (par un appel à dispose()), 2 évènements windowClosed sont lancés, et aucun windowClosing...

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
        final boolean[] splashOk = new boolean[1];
        try {
            SwingUtilities.invokeAndWait(new Runnable() {
 
                public void run() {
                    try {
                        LoadingSplashScreen splash = LoadingSplashScreen.showSplashScreen(5000);
                        splashOk[0] = true;
                        ModuleLoader.getModuleLoader().addLoadingListener(splash);
                        splash.addWindowListener(new WindowAdapter() {
 
                            @Override public void windowClosed(WindowEvent e) {
                                System.out.println("closed");
                                instance = new MyFreeTV();
                            }
 
                            @Override public void windowClosing(WindowEvent e) {
                                System.out.println("closing");
                            }
 
                        });
                    } catch(SplashScreenException e) {
                        Logger.getLogger("MyFreeTV").warning("Le splashscreen n'est pas disponible.");
                    }
                }
            });
        } catch(InvocationTargetException ite) {} catch(InterruptedException ie) {}
 
        ModuleLoader.getModuleLoader().load();
 
        /* Si on n'a pas pu charger le splashscreen, on lance quand même MyFreeTV. */
        if(!splashOk[0])
            instance = new MyFreeTV();
Résultat:
Une idée?