📄 chartapplet1.java
字号:
{
int l4 = Integer.parseInt(s.substring(s.indexOf("_") + 1));
theChart.setLegendImage(l4, null);
if(s1 != null && s1.trim().length() > 0)
{
java.awt.Image image = getImage(getDocumentBase(), s1);
if(image != null)
{
theChart.addImage(s, image);
theChart.setLegendImage(l4, s);
}
}
}
catch(NumberFormatException _ex)
{
System.out.println("Invalid legend index: " + s);
}
catch(SecurityException _ex)
{
System.out.println("Security exception, could not load image: " + s1);
}
finally { }
else
if(s.startsWith("printasbitmap"))
theChart.setPrintAsBitmap(s1 != null && s1.trim().toLowerCase().equals("true"));
else
if(s.equals("floatingonlegendoff"))
theChart.setFloatingOnLegendOn(s1 == null || !s1.trim().equalsIgnoreCase("true"));
else
System.out.println("Invalid parameter name: " + s);
}
public String getParameter(String s)
{
String s1 = null;
if(parentApplet != null)
s1 = parentApplet.getParameter(s);
else
try
{
s1 = super.getParameter(s);
}
catch(NullPointerException _ex) { }
return s1;
}
private URL createURL(String s)
{
URL url = null;
try
{
url = new URL(s);
}
catch(MalformedURLException _ex)
{
URL url1 = getDocumentBase();
if(url1 == null)
return null;
String s1 = url1.toExternalForm();
int i = s1.lastIndexOf("?");
if(i > -1)
s1 = s1.substring(0, i);
if(!s1.endsWith("/"))
s1 = s1.substring(0, s1.lastIndexOf("/") + 1);
if(s1.startsWith("file:/\\"))
s1 = "file://" + s1.substring(8);
try
{
url = new URL(s1 + s);
}
catch(MalformedURLException _ex2)
{
System.out.println("Invalid URL: " + s1);
}
}
return url;
}
protected void refresh()
{
}
public void run()
{
try
{
Thread.sleep((int)Math.random() * 1000);
do
{
Thread.sleep(automaticRefreshTime);
refresh();
} while(true);
}
catch(InterruptedException _ex)
{
return;
}
}
public void init()
{
String s = getParameter(prefix + "chartClass");
if(s != null)
theChart = createChart(s);
reset();
if(theChart == null)
return;
String s1 = getParameter(prefix + "doubleBufferingOff");
if(s1 != null && s1.equals("true"))
{
add("Center", theChart);
} else
{
NonFlickerPanel nonflickerpanel = new NonFlickerPanel(new BorderLayout());
nonflickerpanel.add("Center", theChart);
add("Center", nonflickerpanel);
}
theChart.setAutomaticRepaintOn(false);
int i = 1;
int j = 0;
Double adouble[] = getDoubleValues(getParameter(prefix + "sampleValues"));
if(adouble != null)
{
j = adouble.length;
String s2 = getParameter(prefix + "sampleCount");
if(s2 != null)
try
{
j = Integer.parseInt(s2);
}
catch(NumberFormatException _ex)
{
System.out.println("Invalid sampleCount: " + s2);
}
theChart.setSeriesCount(i);
theChart.setSampleCount(j);
initParameter("sampleValues", getParameter(prefix + "sampleValues"));
}
if(adouble == null)
{
String s3 = getParameter(prefix + "seriesCount");
if(s3 != null)
try
{
i = Math.max(1, Integer.parseInt(s3));
}
catch(NumberFormatException _ex)
{
System.out.println("Invalid seriesCount: " + s3);
}
s3 = getParameter(prefix + "sampleCount");
if(s3 != null)
{
try
{
j = Integer.parseInt(s3);
}
catch(NumberFormatException _ex)
{
System.out.println("Invalid sampleCount: " + s3);
}
} else
{
for(int k = 0; k < i; k++)
{
Double adouble1[] = getDoubleValues(getParameter(prefix + "sampleValues_" + k));
if(adouble1 == null)
adouble1 = getDoubleValues(getParameter(prefix + "series" + k + "_values"));
if(adouble1 != null)
j = Math.max(j, adouble1.length);
}
}
theChart.setSeriesCount(i);
theChart.setSampleCount(j);
for(int l = 0; l < i; l++)
{
String s5 = getParameter(prefix + "sampleValues_" + l);
if(s5 == null)
s5 = getParameter(prefix + "series" + l + "_values");
initParameter("sampleValues_" + l, s5);
}
}
String s4 = getParameter(prefix + "chartTitle");
if(s4 != null && s4.trim().length() > 0)
initParameter("chartTitle", s4);
else
initParameter("chartTitle", getParameter(prefix + "title"));
initParameter("sampleColors", getParameter(prefix + "sampleColors"));
initParameter("legendColors", getParameter(prefix + "legendColors"));
initParameter("valueLabelsOn", getParameter(prefix + "valueLabelsOn"));
initParameter("legendOn", getParameter(prefix + "legendOn"));
initParameter("labelDelimiter", getParameter(prefix + "labelDelimiter"));
initParameter("sampleLabels", getParameter(prefix + "sampleLabels"));
initParameter("seriesLabels", getParameter(prefix + "seriesLabels"));
initParameter("sampleLabelColors", getParameter(prefix + "sampleLabelColors"));
initParameter("seriesLabelColors", getParameter(prefix + "seriesLabelColors"));
initParameter("legendPosition", getParameter(prefix + "legendPosition"));
initParameter("automaticRefreshTime", getParameter(prefix + "automaticRefreshTime"));
initParameter("background", getParameter(prefix + "background"));
initParameter("foreground", getParameter(prefix + "foreground"));
initParameter("chartBackground", getParameter(prefix + "chartBackground"));
initParameter("chartForeground", getParameter(prefix + "chartForeground"));
initParameter("titleFont", getParameter(prefix + "titleFont"));
initParameter("font", getParameter(prefix + "font"));
initParameter("legendFont", getParameter(prefix + "legendFont"));
initParameter("3DModeOn", getParameter(prefix + "3DModeOn"));
initParameter("3DDepth", getParameter(prefix + "3DDepth"));
initParameter("legendLabels", getParameter(prefix + "legendLabels"));
initParameter("graphInsets", getParameter(prefix + "graphInsets"));
initParameter("rangeDecimalCount", getParameter(prefix + "rangeDecimalCount"));
initParameter("rangeDecimalCount_2", getParameter(prefix + "rangeDecimalCount_2"));
initParameter("valueLinesOn", getParameter(prefix + "valueLinesOn"));
initParameter("maxValueLineCount", getParameter(prefix + "maxValueLineCount"));
initParameter("sampleAxisRange", getParameter(prefix + "sampleAxisRange"));
initParameter("defaultGridLinesOn", getParameter(prefix + "defaultGridLinesOn"));
initParameter("gridLines", getParameter(prefix + "gridLines"));
initParameter("gridLinesColor", getParameter(prefix + "gridLinesColor"));
initParameter("defaultGridLinesColor", getParameter(prefix + "defaultGridLinesColor"));
initParameter("gridLineColors", getParameter(prefix + "gridLineColors"));
initParameter("valueLinesColor", getParameter(prefix + "valueLinesColor"));
initParameter("rangeLabelsOff", getParameter(prefix + "rangeLabelsOff"));
initParameter("rangeLabelFont", getParameter(prefix + "rangeLabelFont"));
initParameter("rangeLabelPrefix", getParameter(prefix + "rangeLabelPrefix"));
initParameter("rangeLabelPostfix", getParameter(prefix + "rangeLabelPostfix"));
initParameter("sampleAxisLabel", getParameter(prefix + "sampleAxisLabel"));
initParameter("rangeAxisLabel", getParameter(prefix + "rangeAxisLabel"));
initParameter("rangeAxisLabel_2", getParameter(prefix + "rangeAxisLabel_2"));
initParameter("sampleAxisLabelFont", getParameter(prefix + "sampleAxisLabelFont"));
initParameter("rangeAxisLabelFont", getParameter(prefix + "rangeAxisLabelFont"));
initParameter("visibleSamples", getParameter(prefix + "visibleSamples"));
initParameter("rangeAxisLabelAngle", getParameter(prefix + "rangeAxisLabelAngle"));
initParameter("rangeAxisLabelAngle_2", getParameter(prefix + "rangeAxisLabelAngle_2"));
initParameter("sampleAxisLabelAngle", getParameter(prefix + "sampleAxisLabelAngle"));
initParameter("valueLabelAngle", getParameter(prefix + "valueLabelAngle"));
initParameter("barLabelAngle", getParameter(prefix + "barLabelAngle"));
initParameter("sampleLabelAngle", getParameter(prefix + "sampleLabelAngle"));
initParameter("rangePosition", getParameter(prefix + "rangePosition"));
initParameter("rangePosition_2", getParameter(prefix + "rangePosition_2"));
initParameter("rangeAdjusterPosition", getParameter(prefix + "rangeAdjusterPosition"));
initParameter("rangeAdjusterPosition_2", getParameter(prefix + "rangeAdjusterPosition_2"));
initParameter("rangeColor", getParameter(prefix + "rangeColor"));
initParameter("rangeColor_2", getParameter(prefix + "rangeColor_2"));
initParameter("rangeAdjusted_1", getParameter(prefix + "rangeAdjusted_1"));
initParameter("rangeAdjusted_2", getParameter(prefix + "rangeAdjusted_2"));
initParameter("sampleDecimalCount", getParameter(prefix + "sampleDecimalCount"));
initParameter("valueLabelPrefix", getParameter(prefix + "valueLabelPrefix"));
initParameter("valueLabelPostfix", getParameter(prefix + "valueLabelPostfix"));
initParameter("printAsBitmap", getParameter(prefix + "printAsBitmap"));
initParameter("floatingLabelFont", getParameter(prefix + "floatingLabelFont"));
initParameter("floatingOnLegendOff", getParameter(prefix + "floatingOnLegendOff"));
for(int i1 = 0; i1 < i; i1++)
{
initParameter("valueLabelPrefix_" + i1, getParameter(prefix + "valueLabelPrefix_" + i1));
initParameter("valueLabelPostfix_" + i1, getParameter(prefix + "valueLabelPostfix_" + i1));
initParameter("seriesRange_" + i1, getParameter(prefix + "seriesRange_" + i1));
initParameter("valueLabelsOn_" + i1, getParameter(prefix + "valueLabelsOn_" + i1));
initParameter("sampleDecimalCount_" + i1, getParameter(prefix + "sampleDecimalCount_" + i1));
}
initParameter("urltarget", getParameter(prefix + "sample_urltarget"));
for(int j1 = 0; j1 < j; j1++)
{
initParameter("url_" + j1, getParameter(prefix + "sample" + j1 + "_url"));
initParameter("urltarget_" + j1, getParameter(prefix + "sample" + j1 + "_urltarget"));
}
initParameter("url", getParameter(prefix + "url"));
setParameter("urltarget", "_self");
initParameter("urltarget", getParameter(prefix + "urltarget"));
int k1 = Math.max(i, j);
for(int l1 = 0; l1 < k1; l1++)
{
initParameter("url_" + l1, getParameter(prefix + "url_" + l1));
initParameter("urltarget_" + l1, getParameter(prefix + "urltarget_" + l1));
}
for(int i2 = 0; i2 < i; i2++)
{
for(int j2 = 0; j2 < j; j2++)
{
String s7 = "url_" + i2 + "_" + j2;
initParameter(s7, getParameter(prefix + s7));
s7 = "urltarget_" + i2 + "_" + j2;
initParameter(s7, getParameter(prefix + s7));
}
}
k1 = 0;
targets = new Hashtable();
for(String s6 = getParameter(prefix + "targetValueLine_0"); s6 != null && s6.length() > 0; s6 = getParameter(prefix + "targetValueLine_" + k1))
{
initParameter("targetValueLine_" + k1, s6);
k1++;
}
String as[] = theChart.getLegendLabels();
if(as != null)
{
for(int k2 = 0; k2 < as.length; k2++)
{
String s8 = getParameter(prefix + "legendImage_" + k2);
initParameter("legendImage_" + k2, s8);
}
}
theChart.setAutomaticRepaintOn(true);
}
protected Font createFont(String s, String s1, int i, int j)
{
StringTokenizer stringtokenizer = new StringTokenizer(s, ",");
String s2 = s1;
int k = Math.max(0, j);
int l = i;
if(stringtokenizer.hasMoreTokens())
s2 = stringtokenizer.nextToken();
if(stringtokenizer.hasMoreTokens())
l = getFontType(stringtokenizer.nextToken());
if(stringtokenizer.hasMoreTokens())
try
{
k = Integer.parseInt(stringtokenizer.nextToken().trim());
}
catch(NumberFormatException _ex)
{
k = 12;
}
return new Font(s2, l, k);
}
public void print(Graphics g)
{
theChart.print(g);
}
private String createURLParam(String s, int i, int j)
{
String s1 = s;
if(i >= 0)
s1 += "_" + i;
if(j >= 0)
s1 += "_" + j;
return s1;
}
/**
* @deprecated Method init is deprecated
*/
protected void init(Chart chart)
{
theChart = chart;
init();
}
/**
* @deprecated Method setParameter is deprecated
*/
protected void setParameter(Chart chart, String s, String s1)
{
theChart = chart;
setParameter(s, s1);
}
public Chart theChart;
protected Vector overlayChartApplets;
private String prefix;
private double rangeStep[];
private int automaticRefreshTime;
private Thread refreshThread;
protected String labelDelimiter;
private Hashtable targets;
private Hashtable urlList;
private Hashtable urlTargetList;
private static Cursor HAND_CURSOR;
private static Cursor POINT_CURSOR;
private int lastSelectedSample;
private int lastSelectedSeries;
private long lastSelectedTime;
private static final int DOUBLE_CLICK_TIME = 350;
private Applet parentApplet;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -