Examples of OwnPreferences


Examples of xplanetconfigurator.util.OwnPreferences

        this.setVisible(false);
    }//GEN-LAST:event_jMenuItemHideInSystemTrayActionPerformed

    private void formWindowIconified(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowIconified
//        JOptionPane.showMessageDialog(null, "The Window is now hiding in the System Tray");
        OwnPreferences prefs =
                OwnPreferences.userNodeForPackage(MainFrame.class);
        boolean showHideDialog = prefs.getBoolean(MainFrame.KEY_SHOW_HIDE_DIALOG, true);
        if (showHideDialog) {
            JDialogHideMessage f = new JDialogHideMessage(this);
            f.setModalityType(ModalityType.APPLICATION_MODAL);
            f.setVisible(true);
        }
View Full Code Here

Examples of xplanetconfigurator.util.OwnPreferences

        rf.resetXPlanetDirs();
        this.checkWetherXPlanetRessourcesAreKnown();
    }//GEN-LAST:event_jMenuItemGuessRessourcesActionPerformed

    private void jCheckBoxMenuItemShowHideDialogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxMenuItemShowHideDialogActionPerformed
        OwnPreferences prefs =
                OwnPreferences.userNodeForPackage(MainFrame.class);
        boolean showHideDialog = this.jCheckBoxMenuItemShowHideDialog.isSelected();
        prefs.putBoolean(MainFrame.KEY_SHOW_HIDE_DIALOG, showHideDialog);
    }//GEN-LAST:event_jCheckBoxMenuItemShowHideDialogActionPerformed
View Full Code Here

Examples of xplanetconfigurator.util.OwnPreferences

        }
    }

    private void loadUserPrefs() {
        logger.finer("Getting user preferences...");
        OwnPreferences prefs = OwnPreferences.userNodeForPackage(this.getClass());

        int xPos = 50;
        int yPos = 50;
        int with = 960;
        int height = 700;
        int x = prefs.getInt(MainFrame.FRAME_X, xPos);
        int y = prefs.getInt(MainFrame.FRAME_Y, yPos);
        int h = prefs.getInt(MainFrame.FRAME_HEIGHT, height);
        int w = prefs.getInt(MainFrame.FRAME_WIDTH, with);

        this.setSize(new Dimension(w, h));

        if (x == xPos && y == yPos) {
            logger.finer("Position in middle of window. Seems to be used for the first time.");
            this.setLocationRelativeTo(null); //center it
        } else {
            logger.finer("Position of window: x='" + x + "', y='" + y + "'. Size of window: h='" + h + "', w='" + w + "'.");
            this.setLocation(x, y);
        }

        this.restoreMainDividerLocation();
        int i = prefs.getInt(MainFrame.GUI_DIVIDER_LOCATION_VERTICAL, 200);
        this.jSplitPaneTreeControls.setDividerLocation(i);

        // Restore the file extension for command files. They are generated
        // every time the config is saved or started. On Windows this cmd will
        // start XPlanet and the Downloader.
        MainFrame.FILE_EXTENSION_CMD_FILE = prefs.get(MainFrame.KEY_SUFFIX_CMD_FILE, "cmd");
        String osName = System.getProperty("os.name");
        if (osName != null) {
            // Guess for Windows
            if (osName.matches("(?i).*windows.+")) {
                MainFrame.FILE_EXTENSION_CMD_FILE = prefs.get(MainFrame.KEY_SUFFIX_CMD_FILE, "cmd");
            }
            // TODO: Implement for Linux and Mac
        }

        // Restore the config name
        MainFrame.setCONFIG_NAME(prefs.get(MainFrame.KEY_CONFIG_NAME, ""));

        // Restore expert mode or non expert mode
        boolean b = prefs.getBoolean(MainFrame.KEY_USING_EXPERT_MODE, false);
        this.jCheckBoxExpertMode.setSelected(b);

        b = prefs.getBoolean(MainFrame.KEY_ALLOW_INTERNET_CONNECTION, true);
        this.jCheckBoxMenuItemAllowInternetConnection.setSelected(b);

        boolean showHideDialog = prefs.getBoolean(MainFrame.KEY_SHOW_HIDE_DIALOG, true);
        this.setIsShowinHideDialog(showHideDialog);

        boolean runAndHide = prefs.getBoolean(MainFrame.KEY_RUN_AT_STARTUP, false);
        this.jCheckBoxMenuItemRunAtStartUp.setSelected(runAndHide);
    }
View Full Code Here

Examples of xplanetconfigurator.util.OwnPreferences

        boolean runAndHide = prefs.getBoolean(MainFrame.KEY_RUN_AT_STARTUP, false);
        this.jCheckBoxMenuItemRunAtStartUp.setSelected(runAndHide);
    }

    public void setIsShowinHideDialog(boolean show) {
        OwnPreferences prefs = OwnPreferences.userNodeForPackage(this.getClass());
        prefs.putBoolean(MainFrame.KEY_SHOW_HIDE_DIALOG, show);
        this.jCheckBoxMenuItemShowHideDialog.setSelected(show);
    }
View Full Code Here

Examples of xplanetconfigurator.util.OwnPreferences

        prefs.putBoolean(MainFrame.KEY_SHOW_HIDE_DIALOG, show);
        this.jCheckBoxMenuItemShowHideDialog.setSelected(show);
    }

    public void setIsRunAtStartup() {
        OwnPreferences prefs = OwnPreferences.userNodeForPackage(this.getClass());
        prefs.putBoolean(MainFrame.KEY_RUN_AT_STARTUP, this.jCheckBoxMenuItemRunAtStartUp.isSelected());
    }
View Full Code Here

Examples of xplanetconfigurator.util.OwnPreferences

     * The executable must match '(?i)xplanet|xplanet.exe'. If nothing is found
     * the program chooses 'xplanet.exe' for windows and 'xplanet' for Linux and
     * Mac OS without any preceeding path.
     */
    private void guessXPlanetExecutable() {
        OwnPreferences prefs = OwnPreferences.userNodeForPackage(this.getClass());
        String executable = prefs.get(MainFrame.KEY_PATH_XPLANET_EXECUTABLE, null);
        // For first time usage this will set back the xplanet.dir.tested
        MainFrame.setXPLANET_EXECUTABLE(executable);
        if (MainFrame.PATH_XPLANET_EXECUTABLE != null && !"".equals(MainFrame.PATH_XPLANET_EXECUTABLE)) {
            this.logger.finer("Found the absolute path to the XPlanet executable in the user preferences: '" + MainFrame.PATH_XPLANET_EXECUTABLE + "'");
        } else {
View Full Code Here

Examples of xplanetconfigurator.util.OwnPreferences

        int y = this.getY();
        Dimension d = this.getSize();
        int h = (int) d.getHeight();
        int w = (int) d.getWidth();

        OwnPreferences prefs = OwnPreferences.userNodeForPackage(this.getClass());

        // Frame position and size
        prefs.putInt(MainFrame.FRAME_X, x);
        prefs.putInt(MainFrame.FRAME_Y, y);
        prefs.putInt(MainFrame.FRAME_HEIGHT, h);
        prefs.putInt(MainFrame.FRAME_WIDTH, w);
        logger.finer("Saved position of window: x='" + x + "', y='" + y + "'. Size of window: h='" + h + "', w='" + w + "'.");

        this.storeMainDividerLocation();
        prefs.putInt(MainFrame.GUI_DIVIDER_LOCATION_VERTICAL, this.jSplitPaneTreeControls.getDividerLocation());

        String executable = MainFrame.getXPLANET_EXECUTABLE();
        prefs.put(MainFrame.KEY_PATH_XPLANET_EXECUTABLE, executable);
        prefs.put(MainFrame.KEY_SUFFIX_CMD_FILE, MainFrame.FILE_EXTENSION_CMD_FILE);

        prefs.putBoolean(MainFrame.KEY_USING_EXPERT_MODE, this.jCheckBoxExpertMode.isSelected());
        prefs.putBoolean(MainFrame.KEY_ALLOW_INTERNET_CONNECTION, this.jCheckBoxMenuItemAllowInternetConnection.isSelected());

        // Save the config name at "Save" only.
        // prefs.put(MainFrame.KEY_CONFIG_NAME, MainFrame.getCONFIG_NAME());
    }
View Full Code Here

Examples of xplanetconfigurator.util.OwnPreferences

        // Save the config name at "Save" only.
        // prefs.put(MainFrame.KEY_CONFIG_NAME, MainFrame.getCONFIG_NAME());
    }

    private void storeMainDividerLocation() {
        OwnPreferences prefs = OwnPreferences.userNodeForPackage(this.getClass());
        prefs.putInt(MainFrame.GUI_DIVIDER_LOCATION_HORIZONTAL, this.jSplitPaneMainControlsCommand.getDividerLocation());
    }
View Full Code Here

Examples of xplanetconfigurator.util.OwnPreferences

        OwnPreferences prefs = OwnPreferences.userNodeForPackage(this.getClass());
        prefs.putInt(MainFrame.GUI_DIVIDER_LOCATION_HORIZONTAL, this.jSplitPaneMainControlsCommand.getDividerLocation());
    }

    private void restoreMainDividerLocation() {
        OwnPreferences prefs = OwnPreferences.userNodeForPackage(this.getClass());
        int i = prefs.getInt(MainFrame.GUI_DIVIDER_LOCATION_HORIZONTAL, 430);
        this.jSplitPaneMainControlsCommand.setDividerLocation(i);
    }
View Full Code Here

Examples of xplanetconfigurator.util.OwnPreferences

        DefaultMutableTreeNode node = (DefaultMutableTreeNode) this.treeNodes.get("-config");
        JPanelControlParametersConfig panel = (JPanelControlParametersConfig) node.getUserObject();
        panel.loadConfigNames();

        // Save for the next start of the application
        OwnPreferences prefs = OwnPreferences.userNodeForPackage(this.getClass());
        prefs.put(MainFrame.KEY_CONFIG_NAME, MainFrame.getCONFIG_NAME());

        // Show that save succeeded
        this.jButtonSave.setEnabled(false);
        this.jMenuItemSave.setEnabled(false);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.