Package penny.downloadmanager.util

Examples of penny.downloadmanager.util.SwingExceptionHandler


        });
    }
   
    public static Thread getThread(Runnable runnable) {
        Thread t = new Thread(runnable);
        t.setUncaughtExceptionHandler(new SwingExceptionHandler());
        return t;
    }
View Full Code Here


    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) throws Exception {
        Thread.currentThread().setUncaughtExceptionHandler(new SwingExceptionHandler());
        Toolkit.getDefaultToolkit().getSystemEventQueue().push(new EventRateCounter());
       
        //System.setProperty("socksProxyHost", "localhost");
        //System.setProperty("socksProxyPort", "9050");
        Runtime.getRuntime().addShutdownHook(new Thread() {

            @Override
            public void run() {
                try {
                    Model.getTaskSaver().saveList();
                    System.out.println("saved tasks");
                } catch (Exception ex) {
                    System.out.println("could not save tasks");
                    ex.printStackTrace();
                }

                try {
                    Model.getDownloadSaver().saveAllDownloads();
                    System.out.println("saved downloads");
                } catch (Exception ex) {
                    System.out.println("could not save downloads");
                    ex.printStackTrace();
                }
               
                try {
                    JavaDBDataSource.getInstance().shutdownDB();
                    System.out.println("shutdownDB()");
                } catch (Exception ex) {
                    System.out.println("shutdownDB() exception is normal");
                    System.out.println(ex);
                }
            }
        });

        Model.build();
        View.build();
        Control.build();

        Model.loadData();
       
        View.initViewState();

        try {
            SwingUtilities.invokeAndWait(new Runnable() {

                @Override
                public void run() {
                    Thread.currentThread().setUncaughtExceptionHandler(new SwingExceptionHandler());
                }
            });

        } catch (InterruptedException ex) {
            Logger.getLogger(Application.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

TOP

Related Classes of penny.downloadmanager.util.SwingExceptionHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.