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

📄 antialiasing.java

📁 一个完整的
💻 JAVA
字号:
package cn.com.fcsoft.chart.examples;
import cn.com.fcsoft.chart.*;
import java.awt.*;

/**
 * This example shows how to use antialiasing in EasyCharts.
 * This example requires jdk1.2
 * @author meiqi.
 */
public class Antialiasing {
	
	public static void main(String[] argv) {
		// create the chart
		LineChart chart = new LineChart();
		chart.setSampleCount(20);
		chart.setSeriesCount(4);
		for (int serie = 0; serie < chart.getSeriesCount(); serie++) {
			double[] values = new double[chart.getSampleCount()];
			for (int i = 0; i < values.length; i++) {
				values[i] = Math.round(Math.random()*10 + (serie*10));
			}
			chart.setSampleValues(serie, values);
			chart.setSeriesLabel(serie, "series " + serie + "\n");
		}
		chart.setSampleScrollerOn(true);
		chart.setRangeAdjusterOn(0,true);
		chart.setRelativeRange(1,10);
		
		// create a graphics context to apply antialiasing for
		Image image = chart.createImage(1024, 768);
		Graphics2D g2D = (Graphics2D)image.getGraphics();
		g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
		// provide the created graphics context to the chart
		chart.setExternalGraphics(g2D, image);

		// display the chart
		com.objectplanet.chart.NonFlickerPanel p = new com.objectplanet.chart.NonFlickerPanel(new BorderLayout());
		p.add("Center", chart);
		Frame f = new Frame();
		f.add("Center", p);
		f.setSize(400,280);
		f.show();
	}
}

⌨️ 快捷键说明

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