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

📄 labels.java

📁 j2me写的google地图
💻 JAVA
字号:
// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov  Date: 2008-6-16 11:25:18
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   Labels.java

package com.eightmotions.util;

import java.io.*;
import java.util.Vector;

// Referenced classes of package com.eightmotions.util:
//            UtilMidp

public class Labels
{

    public static void setLang(String inLang)
    {
        if(inLang != lang)
        {
            System.out.println("Setting labels to:" + inLang);
            Current = new Labels("/lang/Engine_" + inLang.toUpperCase() + ".csv");
            lang = inLang;
        }
    }

    public String get(int id)
    {
        if(id >= 0 && id < labels.size())
            return (String)labels.elementAt(id);
        else
            return "Label error:" + id;
    }

    public static String getL(int id)
    {
        if(Current != null)
            return Current.get(id);
        else
            return "Init Error";
    }

    public Labels(String name)
    {
        labels = new Vector();
        InputStream is = null;
        try
        {
            is = getClass().getResourceAsStream(name);
        }
        catch(Exception e)
        {
            e.printStackTrace();
            UtilMidp.showException(e);
        }
        if(is == null)
            is = getClass().getResourceAsStream("lang/Engine_EN.csv");
        if(is != null)
            setLabels(is);
    }

    public void setLabels(InputStream is)
    {
        try
        {
            InputStreamReader reader = new InputStreamReader(is, "UTF-8");
            int c = 0;
            StringBuffer buff = new StringBuffer();
            int idx = 0;
            try
            {
                do
                {
                    c = reader.read();
                    if(c != 10)
                    {
                        buff.append((char)c);
                    } else
                    {
                        labels.setSize(idx + 1);
                        labels.setElementAt(buff.toString(), idx++);
                        buff.setLength(0);
                    }
                } while(c != -1);
            }
            catch(Exception e)
            {
                e.printStackTrace();
                UtilMidp.showException(e);
            }
        }
        catch(UnsupportedEncodingException ex)
        {
            ex.printStackTrace();
            UtilMidp.showException(ex);
        }
    }

    public static Labels Current = null;
    static String lang = "";
    Vector labels;

}

⌨️ 快捷键说明

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