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

📄 graphicalinstaller.java

📁 用于移动设备上的java虚拟机源代码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
        progressForm.set(progressGaugeIndex, progressGauge);        // this ends the background thread of gauge.        oldProgressGauge.setValue(Gauge.CONTINUOUS_IDLE);        if (url == null) {            urlItem = new StringItem("", "");            progressForm.set(progressUrlIndex, urlItem);        } else if (url.length() != 0) {            urlItem =                new StringItem(Resource.getString("Website") + ": ", url);            progressForm.set(progressUrlIndex, urlItem);        }        lastDisplayChange = System.currentTimeMillis();    }    /**     * Give the user a chance to act on warning during an installation.     *     * @param name name of the MIDlet suite to insert into the message     * @param vendor vendor of the MIDlet suite to insert into the message,     *        can be null     * @param version version of the MIDlet suite to insert into the message,     *        can be null     * @param jadUrl URL of a JAD, can be null     * @param e last exception from the installer     */    private void warnUser(String name, String vendor, String version,                          String jadUrl, InvalidJadException e) {        Form warningForm;        warningForm = new Form(null);        warningForm.setTitle(Resource.getString("Warning"));        warningForm.append(translateJadException(e, name, vendor, version,                                                 jadUrl));         warningForm.addCommand(cancelCmd);        warningForm.addCommand(okCmd);        warningForm.setCommandListener(this);        display.setCurrent(warningForm);    }    /**     * Resume the install after a the user overrides a warning.     */    private void resumeInstallAfterWarning() {        // redisplay the progress form        display.setCurrent(progressForm);        backgroundInstaller.continueInstall = true;        synchronized (backgroundInstaller) {            backgroundInstaller.notify();        }    }    /**     * Ask for a username and password.     */    private void getUsernameAndPassword() {        getUsernameAndPasswordCommon("");    }    /**     * Ask for proxy username and password.     */    private void getProxyUsernameAndPassword() {        getUsernameAndPasswordCommon("Firewall Authentication");    }    /**     * Ask a username and password.     *     * @param title title of the password form     */    private void getUsernameAndPasswordCommon(String title) {        if (passwordForm == null) {            passwordForm = new Form(null);            usernameField = new TextField(                            Resource.getString("Please Enter ID"), null, 40,                            TextField.ANY);            passwordForm.append(usernameField);            passwordField = new TextField(                            Resource.getString("Password"), null, 40,                            TextField.PASSWORD);            passwordForm.append(passwordField);            passwordForm.addCommand(cancelCmd);            passwordForm.addCommand(nextCmd);            passwordForm.setCommandListener(this);        }        passwordForm.setTitle(Resource.getString(title));        passwordField.setString("");        display.setCurrent(passwordForm);    }    /**     * Resume the install of the suite with a password and username.     */    private void resumeInstallWithPassword() {        String username;        String password;        username = usernameField.getString();        password = passwordField.getString();        if (username == null || username.length() == 0) {            Alert a = new Alert(Resource.getString("Error"),                              Resource.getString(                             "The ID has not been entered."),                             null, AlertType.ERROR);            a.setTimeout(ALERT_TIMEOUT);            display.setCurrent(a, passwordForm);            return;        }        if (password == null || password.length() == 0) {            Alert a = new Alert(Resource.getString("Error"),                                 Resource.getString(                                "The password has not been entered."),                                null, AlertType.ERROR);            a.setTimeout(ALERT_TIMEOUT);            display.setCurrent(a, passwordForm);            return;        }        // redisplay the progress form        display.setCurrent(progressForm);        if (backgroundInstaller.proxyAuth) {            backgroundInstaller.installState.setProxyUsername(username);            backgroundInstaller.installState.setProxyPassword(password);        } else {            backgroundInstaller.installState.setUsername(username);            backgroundInstaller.installState.setPassword(password);        }        backgroundInstaller.continueInstall = true;        synchronized (backgroundInstaller) {            backgroundInstaller.notify();        }    }    /**     * Confirm the JAR download with the user.     *     * @param state current state of the install.     */    private void displayDownloadConfirmation(InstallState state) {        Form infoForm;        StringItem item;        String name;        String desc;        StringBuffer label = new StringBuffer(40);        StringBuffer value = new StringBuffer(40);        String[] values = new String[1];        name = state.getAppProperty(Installer.SUITE_NAME_PROP);        try {            infoForm = new Form(null);            infoForm.setTitle(Resource.getString("Confirmation"));            values[0] = name;            item = new StringItem(null, Resource.getString(                "Are you sure you want to install \"%1\"?", values));            item.setLayout(Item.LAYOUT_NEWLINE_AFTER | Item.LAYOUT_2);            infoForm.append(item);            // round up the size to a Kilobyte            label.append(Resource.getString("Size"));            label.append(": ");            value.setLength(0);            value.append(state.getJarSize());            value.append(" K");            item = new StringItem(label.toString(), value.toString());            item.setLayout(Item.LAYOUT_NEWLINE_AFTER | Item.LAYOUT_2);            infoForm.append(item);            label.setLength(0);            label.append(Resource.getString("Version"));            label.append(": ");            value.setLength(0);            item = new StringItem(label.toString(),                       state.getAppProperty(Installer.VERSION_PROP));            item.setLayout(Item.LAYOUT_NEWLINE_AFTER | Item.LAYOUT_2);            infoForm.append(item);            label.setLength(0);            label.append(Resource.getString("Vendor"));            label.append(": ");            item = new StringItem(label.toString(),                      state.getAppProperty(Installer.VENDOR_PROP));            item.setLayout(Item.LAYOUT_NEWLINE_AFTER | Item.LAYOUT_2);            infoForm.append(item);            desc = state.getAppProperty(Installer.DESC_PROP);            if (desc != null) {                label.setLength(0);                label.append(Resource.getString("Description"));                label.append(": ");                item = new StringItem(label.toString(), desc);                item.setLayout(Item.LAYOUT_NEWLINE_AFTER | Item.LAYOUT_2);                infoForm.append(item);            }            label.setLength(0);            label.append(Resource.getString("Website"));            label.append(": ");            infoForm.append(new StringItem(label.toString(),                                           state.getJarUrl()));            infoForm.addCommand(continueCmd);            infoForm.addCommand(cancelCmd);            infoForm.setCommandListener(this);            // We need to prevent "flashing" on fast development platforms.            while (System.currentTimeMillis() - lastDisplayChange <                   ALERT_TIMEOUT);            display.setCurrent(infoForm);        } catch (Exception ex) {            StringBuffer sb = new StringBuffer();                        sb.append(name);            sb.append("\n");            sb.append(Resource.getString("Exception"));            sb.append(": ");            sb.append(ex.toString());            displayException(Resource.getString("Cannot access: "),                                 sb.toString());        }    }    /**     * Ask the user during an update if they want to keep the old RMS data.     *     * @param state current state of the install.     */    private void displayKeepRMSForm(InstallState state) {        Form infoForm;        String name;        String desc;        StringBuffer label = new StringBuffer(40);        StringBuffer value = new StringBuffer(40);        String[] values = new String[1];        name = state.getAppProperty(Installer.SUITE_NAME_PROP);        try {            infoForm = new Form(null);            infoForm.setTitle(Resource.getString("Confirmation"));            values[0] = name;            value.append(Resource.getString("Do you want the new version " +                "of %1 to be able to use the information stored by the " +                "old version of %1?", values));            infoForm.append(value.toString());            infoForm.addCommand(keepRMSCmd);            infoForm.addCommand(removeRMSCmd);            infoForm.setCommandListener(this);            // We need to prevent "flashing" on fast development platforms.            while (System.currentTimeMillis() - lastDisplayChange <                   ALERT_TIMEOUT);            display.setCurrent(infoForm);        } catch (Exception ex) {            StringBuffer sb = new StringBuffer();                        sb.append(name);            sb.append("\n");            sb.append(Resource.getString("Exception"));            sb.append(": ");            sb.append(ex.toString());            displayException(Resource.getString("Cannot access: "),                                 sb.toString());        }    }    /**     * Resume the install to start the JAR download.     */    private void startJarDownload() {        updateProgressForm(backgroundInstaller.url, 0, "Connecting...");        // redisplay the progress form        display.setCurrent(progressForm);        backgroundInstaller.continueInstall = true;        synchronized (backgroundInstaller) {            backgroundInstaller.notify();        }    }    /** Confirm the JAR only download with the user. */    private void displayJarOnlyDownloadConfirmation() {        Form infoForm;        StringItem item;        StringBuffer label = new StringBuffer(40);        StringBuffer value = new StringBuffer(40);        String[] values = new String[1];        try {            infoForm = new Form(null);            infoForm.setTitle(Resource.getString("Confirmation"));            values[0] = backgroundInstaller.name;            item = new StringItem(null, Resource.getString(                       "Are you sure you want to install \"%1\"?", values));            item.setLayout(Item.LAYOUT_NEWLINE_AFTER | Item.LAYOUT_2);            infoForm.append(item);            label.append(Resource.getString("Website"));            label.append(": ");            item = new StringItem(label.toString(), backgroundInstaller.url);            item.setLayout(Item.LAYOUT_NEWLINE_AFTER | Item.LAYOUT_2);            infoForm.append(item);            value.append(" \n");            value.append(Resource.getString("There is no further " +                "information available for the application."));            infoForm.append(new StringItem(null, value.toString()));            infoForm.addCommand(continueCmd);            infoForm.addCommand(cancelCmd);            infoForm.setCommandListener(this);            // We need to prevent "flashing" on fast development platforms.            while (System.currentTimeMillis() - lastDisplayChange <                   ALERT_TIMEOUT);            display.setCurrent(infoForm);        } catch (Exception ex) {            StringBuffer sb = new StringBuffer();                        sb.append(backgroundInstaller.name);            sb.append("\n");            sb.append(Resource.getString("Exception"));            sb.append(": ");            sb.append(ex.toString());            displayException(Resource.getString("Cannot access: "),                              sb.toString());        }    }    /**     * Tell the background installer to keep the RMS data.     *     * @param keepRMS set to true to mean the user answered yes     */    private void setKeepRMSAnswer(boolean keepRMS) {        // redisplay the progress form        display.setCurrent(progressForm);        // We need to prevent "flashing" on fast development platforms.        while (System.currentTimeMillis() - lastDisplayChange <               ALERT_TIMEOUT);        backgroundInstaller.continueInstall = keepRMS;        synchronized (backgroundInstaller) {            backgroundInstaller.notify();        }    }    /**     * Alert the user that an action was successful.     *     * @param successMessage message to display to user     */    private void displaySuccessMessage(String successMessage) {        Image icon;        Alert successAlert;        icon = getIconFromStorage(                       (colorDisplay ? "_dukeok8.png" : "_dukeok2.png"));        successAlert = new Alert(null, successMessage, icon, null);        successAlert.setTimeout(ALERT_TIMEOUT);        // We need to prevent "flashing" on fast development platforms.        while (System.currentTimeMillis() - lastDisplayChange <               ALERT_TIMEOUT);        lastDisplayChange = System.currentTimeMillis();        display.setCurrent(successAlert);    }    /**     * Alert the user that an action was canceled. The backgroundInstaller     * will hide the message.     * @param message message to display to user     */    private void displayCancelledMessage(String message) {        Form form;        Image icon;        form = new Form(null);        icon = getIconFromStorage(                       (colorDisplay ? "_ack_8.png" : "_ack_2.png"));        form.append(new ImageItem(null, icon, ImageItem.LAYOUT_CENTER +                                     ImageItem.LAYOUT_NEWLINE_BEFORE +                                     ImageItem.LAYOUT_NEWLINE_AFTER, null));        form.append(message);        display.setCurrent(form);        lastDisplayChange = System.currentTimeMillis();    }    /**     * Display an exception to the user, with a done command.     *     * @param title exception form's title

⌨️ 快捷键说明

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