请使用准确的文字描述作为标题
You may want to use the [ code ] tag in the future.
import java.applet.Applet;
import java.awt.*;
import java.net.*;
import java.util.*;
import java.io.*;
public class JChartApplet extends Applet
{
int width,height,inwidth,inheight,inposx,inposy,labelfontsize,titlefontsize;
int barsize,show_extremes,axisfontsize,ncolumns,printvalues,labelserie;
int minyatzero;
String labelfont,titlefont,title,xaxis,yaxis,axisfont;
Color labelcolor,axiscolor,linecolor[],titlecolor,bgcolor;
JChart canv;
URL conn;
int getintparam(String l,int def)
{
String result;
Integer t;
result=getParameter(l);
if (result!=null)
return new Integer(result).intValue();
else
return def;
}
String getstringparam(String l,String def)
{
String result;
Integer t;
result=getParameter(l);
if (result!=null)
return result;
else
return def;
}
Color getcolorparam(String l,Color def)
{
String result;
Integer t;
result=getParameter(l);
if (result!=null)
{
Color c;
if (result.substring(0,1).equals("#"))
c=new Color(Integer.valueOf(result.substring(1,7),16).intValue());
else
c=Color.getColor(result);
if(c==null)
{
System.out.println("Warning: can't make sense of color "+result);
return def;
}
else
return c;
}
else
return def;
}
public void start()
{
Integer t;
InputStream is;
DataInputStream dis;
String result,dataurl,type,r;
showStatus("Initialization...");
width=getintparam("WIDTH",500);
height=getintparam("HEIGHT",500);
resize(width,height);
ncolumns=getintparam("NCOLUMNS",1);
dataurl=getParameter("DATA");
is=null;
conn=null;
try {conn=new URL(dataurl);} catch(MalformedURLException exc) {
System.out.println("Data are not (no longer) available");}
title=getParameter("TITLE");
if(title!=null)
{
titlefont=getstringparam("TITLEFONT","System");
titlefontsize=getintparam("TITLEFONTSIZE",10);
}
else
titlefontsize=0;
titlecolor=getcolorparam("TITLECOLOR",Color.black);
axiscolor=getcolorparam("AXISCOLOR",Color.blue);
labelcolor=getcolorparam("LABELCOLOR",Color.blue);
bgcolor=getcolorparam("BGCOLOR",Color.white);
type=getParameter("TYPE");
if(type.equalsIgnoreCase("PIE"))
{
linecolor=new Color[3];
linecolor[0]=getcolorparam("LINECOLOR1",Color.cyan);
linecolor[1]=getcolorparam("LINECOLOR2",Color.yellow);
linecolor[2]=getcolorparam("LINECOLOR3",Color.magenta);
}
else
{
linecolor=new Color[ncolumns];
if(ncolumns==1)
linecolor[0]=getcolorparam("LINECOLOR",Color.blue);
else
{
int i;
for(i=0; i!=ncolumns; i++)
{
String s;
s="LINECOLOR"+(new Integer(i+1).toString());
linecolor[i]=getcolorparam(s,Color.blue);
}
}
}
xaxis=getParameter("XAXIS");
yaxis=getParameter("YAXIS");
show_extremes=getintparam("SHOW_EXTREMES",1);
if((yaxis!=null) || (xaxis!=null) || (show_extremes!=0))
{
axisfont=getstringparam("AXISFONT","System");
axisfontsize=getintparam("AXISFONTSIZE",10);
}
else
axisfontsize=0;
minyatzero=getintparam("MINYATZERO",1);
inposx=getintparam("INPOSX",10);
inposy=getintparam("INPOSY",10+titlefontsize);
inwidth=getintparam("INWIDTH",width-20);
inheight=getintparam("INHEIGHT",height-10-inposy-axisfontsize);
labelfont=getstringparam("LABELFONT","System");
labelfontsize=getintparam("LABELFONTSIZE",10);
labelserie=getintparam("LABELSERIE",0);
barsize=getintparam("BARSIZE",0);
printvalues=getintparam("PRINTVALUES",1);
setLayout(new BorderLayout());
canv=new JChart(conn,ncolumns,title,inwidth,inheight,inposx,inposy,inposx,inposy,
type,xaxis,yaxis,new Font(labelfont,Font.PLAIN,labelfontsize),
new Font(titlefont,Font.PLAIN,titlefontsize),
new Font(axisfont,Font.PLAIN,axisfontsize),
barsize,labelserie,printvalues,minyatzero,bgcolor,axiscolor,
labelcolor,linecolor,show_extremes>0,show_extremes>0);
add("West",canv);
showStatus("JChartApplet running");
}
public void paint(Graphics g)
{
canv.repaint();
}
public void destroy()
{
canv=null;
}
public void init()
{
/* non fa nulla perche'pensa a tutto la start */
}
}
用javac后老是提示:
c:\javaexe\src\javaexe>javac JChartApplet.java
JChartApplet.java:15:找不到符号
符号:类 JChart
位置:类 JChartApplet
JChart canv;
下面还有一行和这个类似,
我是个初学者,不知道这样的问题怎么解决,哪位帮帮我?
JChartApplet.java (4.74k)