📄 piechartapplet.java
字号:
// Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov Date: 2002-12-03 18:44:16
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: PieChartApplet.java
package cn.com.fcsoft.chart;
import java.awt.Component;
import java.io.PrintStream;
// Referenced classes of package com.objectplanet.chart:
// ChartApplet, PieChart, Chart
public class PieChartApplet extends ChartApplet
{
public PieChartApplet()
{
}
protected Chart createChart(String s)
{
if(s == null || s.equals(""))
s = "cn.com.fcsoft.chart.PieChart";
try
{
Class class1 = Class.forName(s);
PieChart piechart = (PieChart)class1.newInstance();
return piechart;
}
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.PieChart");
}
return new PieChart();
}
private void initParameter(String s, String s1)
{
if(s1 != null)
setParameter(s, s1);
}
public void setParameter(String s, String s1)
{
if(s == null)
return;
s = s.toLowerCase();
if(s.equals("angle"))
{
if(s1 != null && s1.trim().length() > 0)
try
{
int i = Integer.parseInt(s1);
i = Math.max(10, i);
i = Math.min(80, i);
chart.setAngle(i);
}
catch(NumberFormatException _ex)
{
System.out.println("Invalid angle: " + s1);
chart.setAngle(20);
}
else
chart.setAngle(20);
} else
if(s.equals("depth"))
{
if(s1 != null && s1.trim().length() > 0)
try
{
double d = (new Float(s1)).floatValue();
d = Math.max(0.0D, d);
d = Math.min(1.0D, d);
chart.setDepth((float)d);
}
catch(NumberFormatException _ex)
{
System.out.println("Invalid depth: " + s1);
chart.setDepth(0.40000000596046448D);
}
else
chart.setDepth(0.40000000596046448D);
} else
if(s.equals("serieslabelson"))
chart.setSeriesLabelsOn(s1 != null && s1.toLowerCase().equals("true"));
else
if(s.equals("serieslabelstyle"))
{
chart.setSeriesLabelStyle(0);
if(s1 != null && s1.trim().length() > 0)
if(s1.trim().toLowerCase().equals("inside"))
chart.setSeriesLabelStyle(1);
else
if(s1.trim().toLowerCase().equals("outside"))
chart.setSeriesLabelStyle(2);
} else
if(s.equals("samplelabelson"))
chart.setSampleLabelsOn(s1 != null && s1.toLowerCase().equals("true"));
else
if(s.equals("samplelabelstyle"))
{
chart.setSampleLabelStyle(0);
if(s1 != null && s1.trim().length() > 0)
if(s1.trim().toLowerCase().equals("inside"))
chart.setSampleLabelStyle(1);
else
if(s1.trim().toLowerCase().equals("outside"))
chart.setSampleLabelStyle(2);
} else
if(s.equals("valuelabelson"))
chart.setValueLabelsOn(s1 != null && s1.toLowerCase().equals("true"));
else
if(s.equals("valuelabelstyle"))
{
chart.setValueLabelStyle(0);
if(s1 != null && s1.trim().length() > 0)
if(s1.trim().toLowerCase().equals("inside"))
chart.setValueLabelStyle(1);
else
if(s1.trim().toLowerCase().equals("outside"))
chart.setValueLabelStyle(2);
} else
if(s.equals("percentlabelson"))
chart.setPercentLabelsOn(s1 != null && s1.toLowerCase().equals("true"));
else
if(s.equals("percentlabelstyle"))
{
chart.setPercentLabelStyle(0);
if(s1 != null && s1.trim().length() > 0)
if(s1.trim().toLowerCase().equals("inside"))
chart.setPercentLabelStyle(1);
else
if(s1.trim().toLowerCase().equals("outside"))
chart.setPercentLabelStyle(2);
} else
if(s.equals("pielabelson"))
chart.setPieLabelsOn(s1 != null && s1.toLowerCase().equals("true"));
else
if(s.equals("percentdecimalcount"))
{
if(s1 != null && s1.trim().length() > 0)
try
{
chart.setPercentDecimalCount(Integer.parseInt(s1));
}
catch(NumberFormatException _ex)
{
System.out.println("Invalid percentDecimalCount: " + s1);
chart.setPercentDecimalCount(0);
}
else
chart.setPercentDecimalCount(0);
} else
if(s.equals("sliceseperatoron"))
chart.setSliceSeperatorOn(s1 != null && s1.toLowerCase().equals("true"));
else
if(s.equals("sliceseperatorcolor"))
{
if(s1 != null && s1.length() > 0)
chart.setSliceSeperatorColor(ChartApplet.createColor(s1));
else
chart.setSliceSeperatorColor(null);
} else
if(s.equals("selectionstyle"))
{
byte byte0 = 0;
if(s1 != null)
if(s1.equals("circle"))
byte0 = 1;
else
if(s1.equals("detached"))
byte0 = 2;
chart.setSelectionStyle(byte0);
} else
if(s.equals("detacheddistance"))
{
chart.setDetachedDistance(0.10000000000000001D);
if(s1 != null && s1.length() > 0)
try
{
double d1 = (new Double(s1)).doubleValue();
chart.setDetachedDistance(Math.max(0.0D, d1));
}
catch(NumberFormatException _ex)
{
System.out.println("Invalid detachDistance: " + s1);
}
} else
if(s.startsWith("detachedslices"))
{
int j = s.equals("detachedslices") ? 0 : -1;
try
{
if(s.length() > 15)
j = Integer.parseInt(s.substring(15));
}
catch(NumberFormatException _ex)
{
System.out.println("Invalid index in detachedSlices_N parameter: " + s);
}
Double adouble[] = ChartApplet.getDoubleValues(s1);
int k = chart.getSeriesCount();
int l = chart.getSampleCount();
if(k == 1)
{
for(int i1 = 0; i1 < l; i1++)
chart.setDetachedSlice(0, i1, 0.0D);
if(adouble != null)
{
double d2 = chart.getDetachedDistance();
for(int k1 = 0; k1 < adouble.length; k1++)
{
int i2 = adouble[k1].intValue();
if(i2 < l)
chart.setDetachedSlice(0, i2, d2);
}
}
} else
if(j < l)
{
for(int j1 = 0; j1 < k; j1++)
chart.setDetachedSlice(j1, j, 0.0D);
if(adouble != null)
{
double d3 = chart.getDetachedDistance();
for(int l1 = 0; l1 < adouble.length; l1++)
{
int j2 = adouble[l1].intValue();
if(j2 < k)
chart.setDetachedSlice(j2, j, d3);
}
}
}
} else
{
super.setParameter(s, s1);
}
}
protected void refresh()
{
chart.repaint();
}
public void init()
{
chart = (PieChart)super.theChart;
super.init();
String s = getParameterPrefix();
initParameter("angle", getParameter(s + "angle"));
initParameter("depth", getParameter(s + "depth"));
initParameter("seriesLabelsOn", getParameter(s + "seriesLabelsOn"));
initParameter("seriesLabelStyle", getParameter(s + "seriesLabelStyle"));
initParameter("sampleLabelsOn", getParameter(s + "sampleLabelsOn"));
initParameter("sampleLabelStyle", getParameter(s + "sampleLabelStyle"));
initParameter("valueLabelsOn", getParameter(s + "valueLabelsOn"));
initParameter("valueLabelStyle", getParameter(s + "valueLabelStyle"));
initParameter("percentLabelsOn", getParameter(s + "percentLabelsOn"));
initParameter("percentLabelStyle", getParameter(s + "percentLabelStyle"));
initParameter("pieLabelsOn", getParameter(s + "pieLabelsOn"));
initParameter("percentDecimalCount", getParameter(s + "percentDecimalCount"));
initParameter("sliceSeperatorOn", getParameter(s + "sliceSeperatorOn"));
initParameter("sliceSeperatorColor", getParameter(s + "sliceSeperatorColor"));
initParameter("selectionStyle", getParameter(s + "selectionStyle"));
initParameter("pieLabelFont", getParameter(s + "pieLabelFont"));
initParameter("insideLabelFont", getParameter(s + "insideLabelFont"));
initParameter("detachedDistance", getParameter(s + "detachedDistance"));
initParameter("detachedSlices", getParameter(s + "detachedSlices"));
int i = chart.getSeriesCount() != 1 ? chart.getSampleCount() : 1;
for(int j = 0; j < i; j++)
{
String s3 = getParameter(s + "detachedSlices_" + j);
if(s3 != null)
initParameter("detachedSlices_" + j, s3);
}
String s1 = getParameter(s + "overlay");
initParameter(s + "overlay", getParameter(s + "overlay"));
int k = s1 == null ? 0 : 1;
for(String s2 = getParameter(s + "overlay" + k); s2 != null; s2 = getParameter(s + "overlay" + k))
{
initParameter(s + "overlay" + k, getParameter(s + "overlay" + k));
k++;
}
chart.setAutomaticRepaintOn(true);
}
public PieChart chart;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -