Package jsky.util.gui

Examples of jsky.util.gui.ProgressPanel


            } else {
                suffix = ".tmp"// other image formats...
            }

            File file = File.createTempFile("jsky", suffix, new File(dir));
            ProgressPanel progressPanel = getProgressPanel();
            ProgressBarFilterInputStream in = progressPanel.getLoggedInputStream(url);
            FileOutputStream out = new FileOutputStream(file);

            // copy the data
            byte[] buffer = new byte[8 * 1024];
            while (true) {
                int bytesRead = in.read(buffer);
                if (bytesRead == -1) {
                    break;
                }
                if (progressPanel.isInterrupted()) {
                    throw new ProgressException("Interrupted");
                }
                out.write(buffer, 0, bytesRead);
            }

            in.close();
            out.flush();
            out.close();

            if (!progressPanel.isInterrupted()) {
                SwingUtilities.invokeLater(new NavigatorImageLoader(file.toString(), url));
            }
        }
    }
View Full Code Here

TOP

Related Classes of jsky.util.gui.ProgressPanel

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.