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

📄 barchartapplet.java

📁 一个完整的
💻 JAVA
字号:
// Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov  Date: 2002-12-03 18:39:23
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   BarChartApplet.java

package cn.com.fcsoft.chart;

import java.awt.Component;
import java.io.PrintStream;
import java.util.Vector;

// Referenced classes of package com.objectplanet.chart:
//            ChartApplet, BarChart, Chart

public class BarChartApplet extends ChartApplet
{

    public BarChartApplet()
    {
    }

    protected Chart createChart(String s)
    {
        if(s == null || s.equals(""))
            s = "cn.com.fcsoft.chart.BarChart";
        try
        {
            Class class1 = Class.forName(s);
            BarChart barchart = (BarChart)class1.newInstance();
            return barchart;
        }
        catch(ClassNotFoundException _ex)
        {
            System.out.println("Class not found: " + s);
        }
        catch(InstantiationException _ex)
        {
            System.out.println("Could not create an instance of teh class: " + s);
        }
        catch(IllegalAccessException _ex)
        {
            System.out.println("Illegal access, could not create an instance of class: " + s);
        }
        catch(ClassCastException _ex)
        {
            System.out.println("The class " + s + ", does not extend from com.objectplanet.chart.LineChart");
        }
        return new BarChart();
    }

    private void initParameter(String s, String s1)
    {
        if(s1 != null)
            setParameter(s, s1);
    }

    public void setParameter(String s, String s1)
    {
        if(s == null || chart == null)
            return;
        s = s.toLowerCase();
        if(s.equals("barlabels"))
        {
            if(s1 != null && s1.length() > 0)
            {
                String as[] = getStringValues(ChartApplet.convertLineBreaks(s1));
                chart.setBarLabels(as);
            } else
            {
                chart.setBarLabels(null);
            }
        } else
        if(s.equals("barlabelson"))
            chart.setBarLabelsOn(s1 != null && s1.toLowerCase().equals("true"));
        else
        if(s.equals("barlabelstyle"))
        {
            if(s1 != null && s1.trim().toLowerCase().equals("floating"))
                chart.setBarLabelStyle(1);
            else
            if(s1 != null && s1.trim().toLowerCase().equals("below_and_floating"))
                chart.setBarLabelStyle(2);
            else
                chart.setBarLabelStyle(0);
        } else
        if(s.equals("valuelabelstyle"))
        {
            if(s1 != null && s1.trim().toLowerCase().equals("inside"))
                chart.setValueLabelStyle(1);
            else
            if(s1 != null && s1.trim().toLowerCase().equals("floating"))
                chart.setValueLabelStyle(2);
            else
                chart.setValueLabelStyle(0);
        } else
        if(s.equals("autolabelspacingon"))
            chart.setAutoLabelSpacingOn(s1 != null && s1.trim().toLowerCase().equals("true"));
        else
        if(s.equals("multicoloron"))
            chart.setMultiColorOn(s1 != null && s1.trim().toLowerCase().equals("true"));
        else
        if(s.equals("multiserieson"))
            chart.setMultiSeriesOn(s1 != null && s1.trim().toLowerCase().equals("true"));
        else
        if(s.equals("baroutlineoff"))
            chart.setBarOutlineOn(s1 == null || !s1.trim().toLowerCase().equals("true"));
        else
        if(s.startsWith("baroutlinecolor"))
        {
            chart.setBarOutlineColor(null);
            if(s1 != null)
                chart.setBarOutlineColor(ChartApplet.createColor(s1));
        } else
        if(s.equals("baralignment"))
        {
            if(s1 != null && s1.trim().toLowerCase().equals("horizontal"))
                chart.setBarAlignment(0);
            else
                chart.setBarAlignment(1);
        } else
        if(s.equals("bartype"))
        {
            if(s1 != null && s1.trim().toLowerCase().equals("stacked"))
                chart.setBarType(1);
            else
                chart.setBarType(0);
        } else
        if(s.equals("barwidth"))
            try
            {
                if(s1 != null && s1.trim().length() > 0)
                    chart.setBarWidth((new Double(s1.trim())).doubleValue());
                else
                    chart.setBarWidth(0.40000000000000002D);
            }
            catch(NumberFormatException _ex)
            {
                System.out.println("Invalid barWidth: " + s1);
                chart.setBarWidth(0.40000000000000002D);
            }
        else
            super.setParameter(s, s1);
    }

    protected void refresh()
    {
        chart.repaint();
    }

    public void init()
    {
        chart = (BarChart)super.theChart;
        super.init();
        String s = getParameterPrefix();
        chart.setAutomaticRepaintOn(false);
        initParameter("sampleValues", getParameter(s + "sampleValues"));
        initParameter("barLabelsOn", getParameter(s + "barLabelsOn"));
        initParameter("barLabelStyle", getParameter(s + "barLabelStyle"));
        initParameter("valueLabelStyle", getParameter(s + "valueLabelStyle"));
        initParameter("autoLabelSpacingOn", getParameter(s + "autoLabelSpacingOn"));
        initParameter("multiColorOn", getParameter(s + "multiColorOn"));
        initParameter("multiSeriesOn", getParameter(s + "multiSeriesOn"));
        initParameter("barOutlineOff", getParameter(s + "barOutlineOff"));
        initParameter("barOutlineColor", getParameter(s + "barOutlineColor"));
        initParameter("barAlignment", getParameter(s + "barAlignment"));
        initParameter("barType", getParameter(s + "barType"));
        initParameter("barWidth", getParameter(s + "barWidth"));
        initParameter("barLabelFont", getParameter(s + "barLabelFont"));
        initParameter("valueLabelFont", getParameter(s + "valueLabelFont"));
        initParameter("barLabels", getParameter(s + "barLabels"));
        initParameter("sampleScrollerOn", getParameter(s + "sampleScrollerOn"));
        String s1 = getParameter(s + "overlay");
        initParameter(s + "overlay", getParameter(s + "overlay"));
        int i = s1 == null ? 0 : 1;
        for(String s2 = getParameter(s + "overlay" + i); s2 != null; s2 = getParameter(s + "overlay" + i))
        {
            initParameter(s + "overlay" + i, getParameter(s + "overlay" + i));
            i++;
        }

        setRangeParameters(true);
        for(int j = 0; j < super.overlayChartApplets.size(); j++)
        {
            ChartApplet chartapplet = (ChartApplet)super.overlayChartApplets.elementAt(j);
            if(chartapplet != null)
                chartapplet.setRangeParameters(false);
        }

        chart.setAutomaticRepaintOn(true);
    }

    public BarChart chart;
}

⌨️ 快捷键说明

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