学习JFreeChart(一)(3)
2008-02-23 10:01:04来源:互联网 阅读 ()
這個範例中並沒有對JFreeChart作修飾。
private JFreeChart customizeChart(final JFreeChart chart){
return chart;
}第四步:顯示JFreeChart
ChartPanel是一個繼承JPanel的類別,負責把JFreeChart在應用程式中顯示出來。
我們只要把JFreeChart當成參數傳給ChartPanel的建構子。造出ChartPanel的實體後,設定大小,再當成一般的Panel放入ContentPane中就可以了。
ChartPanel class:
public ChartPanel(JFreeChart chart) public ChartPanel(JFreeChart chart, boolean useBuffer) public ChartPanel(JFreeChart chart, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips) public ChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight, int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips)
chart - the chart.
useBuffer - a flag controlling whether or not an off-screen buffer is used.
properties - a flag indicating whether or not the chart property editor should be available via the popup menu.
save - a flag indicating whether or not save options should be available via the popup menu.
print - a flag indicating whether or not the print option should be available via the popup menu.
zoom - a flag indicating whether or not zoom options should be added to the popup menu.
tooltips - a flag indicating whether or not tooltips should be enabled for the chart.
width - the preferred width of the panel.
height - the preferred height of the panel.
minimumDrawWidth - the minimum drawing width.
minimumDrawHeight - the minimum drawing height.
maximumDrawWidth - the maximum drawing width.
maximumDrawHeight - the maximum drawing height.
public HelloBarChart(){
CategoryDataset dataset = createDataset();
JFreeChart chart = createChart(dataset);
chart = customizeChart(chart);
ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new Dimension(500, 270));
getContentPane().add(chartPanel);
pack();
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}至此第一个例子已经学习完毕,基本了解了JFreeChart的一些基本技术!下面再学习一个柱状图的例子上一篇: 扬扬的J2EE学习笔记(一)概述
下一篇: 对于不同级别classloader define的类的问题处理
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:JBuilder2005 JBoss-4.0.2RC1 J2SDK1.5 Log4j 开发Session Bean
下一篇:webshpere studio application developer 中 jndi 访问DATASOURC
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash
