⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updatemanager.java

📁 JAVA 数学程序库 提供常规的数值计算程序包
💻 JAVA
字号:
package jmathlib.ui.swing;

import java.io.*;
import javax.swing.*;

/**
 * SwingGUI package update manager
 *
 * This class connects to the mathlib's "official" CVS repository,
 * downloads the files and restart SwingGUI.
 *
 * See relese notes - General notes - GN0011.
 * @version 1.0
 */
public class UpdateManager extends JFrame implements Runnable
{
    private String module;



    /**
     * Constructor to fetch the SwingGUI run-time classes (*.class)
     */
    public UpdateManager()
    {
        this("MathLib/UI/Swing");
    }



    /**
     * Constructor to fetch a specified module
     * @param module CVS module to fetch
     */
    public UpdateManager(String module)
    {
        this.module = module;
        Thread updMgrThread = new Thread(this);
        updMgrThread.setPriority(Thread.currentThread().getPriority() + 1);
        updMgrThread.start();
    }



    /**
     * Thread entry-point.
     *
     * This method runs cvs, and update the named modules.
     * The behavior is a bit "dangerous".
     * See DN0011.
     */
    public void run()
    {
        String modules = this.module;
        SwingGUI.runningReference.dispose();
        try
        {
            Process p;
            InputStream ins;
            int errorLevel = -1;

            String cmd = System.getProperty("UPDATEMANAGER_CMD");
            String params1 = System.getProperty("UPDATEMANAGER_PARAMS");
            String params2 = System.getProperty("UPDATEMANAGER_CHECKOUT_PARAMS");
            String command = "\"" + cmd + "\" " + params1 + " " + params2 + " " + module;
            p = Runtime.getRuntime().exec(command);
/*
            ins = p.getInputStream();
            String logString = "";
            while (errorLevel == -1)
            {
                while (ins.available() > 0)
                {
                    logString += (char) ins.read();
                }
                p.getOutputStream().write((""+'\n').getBytes());
                try {  errorLevel = p.exitValue(); } catch (IllegalThreadStateException itse) {}
            }
 */
            errorLevel = p.waitFor();
        }
        catch (IOException ioe)
        {
            ioe.printStackTrace();
        }
        catch (InterruptedException ie)
        {
            ie.printStackTrace();
        }
        try
        {
            Class.forName("MathLib.UI.Swing.SwingGUI").newInstance();
        }
        catch (ClassNotFoundException cnfe) { ; }
        catch (InstantiationException ie) { ; }
        catch (IllegalAccessException iae) { ; }
//        SwingGUI.main(args);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -