else if(key.equals("mapzoomindex")) { st.nextToken(); mapZoomIndex = (int)st.nval; }
    public static void load() {        // read, read, read!        try {            File cfgfile = new File(cfgFileName);            if(!cfgfile.exists()) {                return;            }            Reader cr = new FileReader(cfgfile);            StreamTokenizer st = new StreamTokenizer(cr);            st.lowerCaseMode(true);            st.quoteChar('"');            st.commentChar('#');scan:            while(true) {                switch(st.nextToken()) {                case StreamTokenizer.TT_EOF:                    break scan;                case StreamTokenizer.TT_EOL:                    break scan;                case StreamTokenizer.TT_WORD:                    // read in                     String key = st.sval;                    if(key.equals("windowpos")) {                        st.nextToken();                        windowPosX = (int)st.nval;                        st.nextToken();                        windowPosY = (int)st.nval;                    }                    else if(key.equals("windowsize")) {                        st.nextToken();                        windowSizeWidth = (int)st.nval;                        st.nextToken();                        windowSizeHeight = (int)st.nval;                    }                    else if (key.equals("minimapenabled")) {                        st.nextToken();                        minimapEnabled = Boolean.valueOf(st.sval).booleanValue();                    }                    else if(key.equals("minimappos")) {                        st.nextToken();                        minimapPosX = (int)st.nval;                        st.nextToken();                        minimapPosY = (int)st.nval;                    }                    else if(key.equals("minimapzoom")) {                        st.nextToken();                        minimapZoom = (int)st.nval;                    }                    else if(key.equals("displaypos")) {                        st.nextToken();                        displayPosX = (int)st.nval;                        st.nextToken();                        displayPosY = (int)st.nval;                    }                    else if(key.equals("displaysize")) {                        st.nextToken();                        displaySizeWidth = (int)st.nval;                        st.nextToken();                        displaySizeHeight = (int)st.nval;                    }                    else if(key.equals("rulerpos")) {                        st.nextToken();                        rulerPosX = (int)st.nval;                        st.nextToken();                        rulerPosY = (int)st.nval;                    }                    else if(key.equals("rulersize")) {                        st.nextToken();                        rulerSizeWidth = (int)st.nval;                        st.nextToken();                        rulerSizeHeight = (int)st.nval;                    }                    else if(key.equals("rulercolors")) {                        rulerColor1 = loadColor(st, rulerColor1);                        rulerColor2 = loadColor(st, rulerColor2);                    }                    else if(key.equals("minimumdialogsize")) {                        st.nextToken();                        minimumSizeWidth = (int)st.nval;                        st.nextToken();                        minimumSizeHeight = (int)st.nval;                    }                    else if (key.equals("autoendfiring")) {                        st.nextToken();                        autoEndFiring = Boolean.valueOf(st.sval).booleanValue();                    }                    else if (key.equals("nagformasc")) {                        st.nextToken();                        nagForMASC = Boolean.valueOf(st.sval).booleanValue();                    }                    else if (key.equals("nagforpsr")) {                        st.nextToken();                        nagForPSR = Boolean.valueOf(st.sval).booleanValue();                    }                    else if (key.equals("nagfornoaction")) {                        st.nextToken();                        nagForNoAction = Boolean.valueOf(st.sval).booleanValue();                    }                    else if(key.equals("playername")) {                        st.nextToken();                        lastPlayerName = st.sval;                    }                    else if(key.equals("server")) {                        st.nextToken();                        lastServerPass = st.sval;                        st.nextToken();                        lastServerPort = (int)st.nval;                    }                    else if(key.equals("connect")) {                        st.nextToken();                        lastConnectAddr = st.sval;                        st.nextToken();                        lastConnectPort = (int)st.nval;                    }                    else if(key.equals("maptext")) {                        mapTextColor = loadColor(st, mapTextColor);                    }                    else if (key.equals("movedefault")) {                        moveDefaultColor = loadColor(st, moveDefaultColor);                    }                    else if (key.equals("moverun")) {                        moveRunColor = loadColor(st, moveRunColor);                    }                    else if (key.equals("movejump")) {                        moveJumpColor = loadColor(st, moveJumpColor);                    }                    else if (key.equals("moveillegal")) {                        moveIllegalColor = loadColor(st, moveIllegalColor);                    }                    else if (key.equals("movemasc")) {                        moveMASCColor = loadColor(st, moveMASCColor);                    }                    else if(key.equals("maptileset")) {                        st.nextToken();                        mapTileset = st.sval;                    }                    else if(key.equals("minimapcolours")) {                        st.nextToken();                        minimapColours = st.sval;                    }                    else if ( key.equals("mekhitloclog") ) {                        st.nextToken();                        mekHitLocLogName = new String(st.sval);                        try {                            mekHitLocLog = new PrintWriter                                ( new BufferedWriter                                    ( new FileWriter(mekHitLocLogName) ) );                            mekHitLocLog.println( "Table\tSide\tRoll" );                        } catch ( Throwable thrown ) {                            thrown.printStackTrace();                            mekHitLocLog = null;                        }                    }                    else if ( key.equals("showmovestep")) {                        st.nextToken();                        showMoveStep = Boolean.valueOf(st.sval).booleanValue();                    }                    else if(key.equals("movestepdelay")) {                        st.nextToken();                        moveStepDelay = (int)st.nval;                    }                    else if(key.equals("showwrecks")) {                        st.nextToken();                        showWrecks = Boolean.valueOf(st.sval).booleanValue();                    }                    else if(key.equals("soundmute")) {                        st.nextToken();                        soundMute = Boolean.valueOf(st.sval).booleanValue();                    }                    else if(key.equals("soundbingfilename")) {                        st.nextToken();                        soundBingFilename = st.sval;                    }                    else if(key.equals("memorydumpon")) {                        st.nextToken();                        memoryDumpOn = Boolean.valueOf(st.sval).booleanValue();                    }                    else if(key.equals("showmaphexpopup")) {                        st.nextToken();                        showMapHexPopup = Boolean.valueOf(st.sval).booleanValue();                    }                    else if(key.equals("tooltipdelay")) {                        st.nextToken();                        tooltipDelay = (int)st.nval;                    }                    else if(key.equals("unitstartchar")) {                        st.nextToken();                        unitStartChar = (char)st.nval;                    }                    else if(key.equals("shiftscrollsensitivity")) {                        st.nextToken();                        shiftScrollSensitivity = (int)st.nval;                    }                    else if(key.equals("maxpathfindertime")) {                        st.nextToken();                        maxPathfinderTime = (int)st.nval;                    }                    else if(key.equals("explicitscrollonly")) {                        st.nextToken();                        explicitScrollOnly = Boolean.valueOf(st.sval).booleanValue();                    }                    else {                        // Store the key and value in our saved settings.                        st.nextToken();                        String value = st.sval;                        if ( null != value ) {                            saved.put( key, new String(value) );                        }                    }                }            }                        cr.close();        } catch(Exception e) {            System.err.println("error reading settings file:");//             System.err.println(e.getMessage());            e.printStackTrace();        }    }