Package jrdesktop

Source Code of jrdesktop.Config

package jrdesktop;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Properties;

/**
* Config.java
* @author benbac
*/

public class Config {
   
    public static boolean GUI_disabled = true;
   
    public static boolean Systray_disabled = false;
   
    public static void loadConfiguration() {
        if (new File(main.CONFIG_FILE).canRead())
            try {
                Properties properties = new Properties();
                properties.load(new FileInputStream(main.CONFIG_FILE));
                GUI_disabled = Boolean.valueOf(properties.getProperty("GUI-disabled"));
                Systray_disabled = Boolean.valueOf(properties.getProperty("Systray-disabled"));        
            }
            catch (Exception e) {
                e.getStackTrace();
            }
       else
            storeConfiguration()
    }
   
    public static void storeConfiguration () {
        try {
            new File(main.CONFIG_FILE).createNewFile();       
            Properties properties = new Properties();
            properties.put("GUI-disabled", String.valueOf(GUI_disabled));
            properties.put("Systray-disabled", String.valueOf(Systray_disabled));       
            properties.store(new FileOutputStream(main.CONFIG_FILE),
                "jrdesktop configuration file");
           
           
        } catch (Exception e) {
            e.getStackTrace();
        }           
    }           
}
TOP

Related Classes of jrdesktop.Config

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.