请教高手:我编译程序出错?但可以运行用!请帮忙指出问题可能在哪个类或方法(在线)

housl 2002-10-12 04:13:37
javac -deprecation LineTest.java
LineTest.java :87:Warning:addIAxisChartDataSet(org.jcharts.chartData.interfaces.IAxisChartDataSet) in org.jcharts.chartData.DataSeries has been deprecated
dataSeries.addIAxisChartDataSet(iAxisChartDataSet);
1 warning
源代码LineTest.java
package sjk;

import java.awt.*;

import org.jCharts.chartData.*;
import org.jCharts.properties.*;
import org.jCharts.axisChart.*;
import org.jCharts.types.ChartType;
import org.jCharts.test.TestDataGenerator;

import java.io.FileOutputStream;
import java.io.IOException;
import java.awt.*;

import org.jCharts.Chart;
import org.jCharts.encoders.PNGEncoder1;
import java.awt.*;

import org.jCharts.chartData.*;
import org.jCharts.properties.*;
import org.jCharts.axisChart.*;
import org.jCharts.test.TestDataGenerator;
import org.jCharts.types.ChartType;

/************************************************************************************
*
*
*************************************************************************************/
public class Line
{

String[] xAxisLabels ;
String xAxisTitle;
String yAxisTitle;
String title;
String name;

double[][] data;
String[] legendLabels;

public void setxAxisLabels( String[] xAxisLabels)
{
this.xAxisLabels=xAxisLabels;
}

public void setxAxisTitle(String xaxistitle)
{
this.xAxisTitle=xaxistitle;
}
public void setyAxisTitle(String yaxistitle)
{
this.yAxisTitle=yaxistitle;
}

public void settitle(String title)
{
this.title=title;
}
public void setdata(double[][] data)
{
this.data=data;
}
public void setlegendLabels( String[] legendLabels)
{
this.legendLabels=legendLabels;
}

public void setname(String name)
{
this.name=name;
}
public void run() throws ChartDataException
{
this.strokes();
}

private void strokes() throws ChartDataException
{
DataSeries dataSeries = new DataSeries( xAxisLabels, xAxisTitle, yAxisTitle, title );
Stroke[] strokes= { LineChartProperties.DEFAULT_LINE_STROKE, LineChartProperties.DEFAULT_LINE_STROKE, LineChartProperties.DEFAULT_LINE_STROKE };
Shape[] shapes= { PointChartProperties.SHAPE_SQUARE,PointChartProperties.SHAPE_TRIANGLE,PointChartProperties.SHAPE_DIAMOND, PointChartProperties.SHAPE_CIRCLE };
LineChartProperties lineChartProperties = new LineChartProperties(strokes,shapes);

Paint[] paints= TestDataGenerator.getRandomPaints( data.length );

AxisChartDataSet axisChartDataSet= new AxisChartDataSet( data, legendLabels, paints, ChartType.LINE, lineChartProperties );
dataSeries.addIAxisChartDataSet( axisChartDataSet );

ChartProperties chartProperties= new ChartProperties();
AxisProperties axisProperties= new AxisProperties();
LegendProperties legendProperties= new LegendProperties();

AxisChart axisChart= new AxisChart( dataSeries, chartProperties, axisProperties, legendProperties, 500, 300 );

this.exportImage( axisChart, name );
}
void exportImage( Chart chart, String fileName )
{
String extension= ".png";
FileOutputStream fileOutputStream;

try
{
fileOutputStream= new FileOutputStream( fileName + extension );
PNGEncoder1.encode( chart, fileOutputStream );
fileOutputStream.flush();
fileOutputStream.close();
}
catch( IOException ioException )
{
ioException.printStackTrace();
}
}


}

...全文
50 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
saidong 2002-10-12
  • 打赏
  • 举报
回复
java对它过期的方法的警告。编译时"-deprecation"参数就是使这些过期的方法显示出来。 能顺利执行,可不管它们。sun推荐使用代替的新方法。
mercury1231 2002-10-12
  • 打赏
  • 举报
回复
是warning不是syntax error,不用管,我差不多每个程序都有(不知道是好是坏)
wjmmml 2002-10-12
  • 打赏
  • 举报
回复
警告不用管,没有问题的。
你的出在:
AxisChartDataSet axisChartDataSet= new AxisChartDataSet( data, legendLabels, paints, ChartType.LINE, lineChartProperties );
dataSeries.addIAxisChartDataSet( axisChartDataSet );
sun1979song 2002-10-12
  • 打赏
  • 举报
回复
上面说得对,没啥没啥,Over
远太狼 2002-10-12
  • 打赏
  • 举报
回复
用了过期的方法,是个warning
可以不用管他
haode 2002-10-12
  • 打赏
  • 举报
回复
没有错误,是一个警告

62,629

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧