// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov Date: 2007-1-11 20:51:35
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
package demo;
import com.lowagie.text.*;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.Rectangle2D;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.filechooser.FileFilter;
import javax.swing.tree.*;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.ui.*;
// Referenced classes of package demo:
// MemoryUsageDemo, DemoDescription
public class SuperDemo extends ApplicationFrame
implements ActionListener, TreeSelectionListener
{
static class DisplayDemo
implements Runnable
{
public void run()
{
try
{
Class class1 = Class.forName(demoDescription.getClassName());
Method method = class1.getDeclaredMethod("createDemoPanel", null);
JPanel jpanel = (JPanel)method.invoke(null, null);
app.chartContainer.removeAll();
app.chartContainer.add(jpanel);
app.displayPanel.validate();
String s = class1.getName();
String s1 = s;
int i = s.lastIndexOf('.');
if(i > 0)
s1 = s.substring(i + 1);
s1 = s1 + ".html";
app.displayDescription(s1);
}
catch(ClassNotFoundException classnotfoundexception)
{
classnotfoundexception.printStackTrace();
}
catch(NoSuchMethodException nosuchmethodexception)
{
nosuchmethodexception.printStackTrace();
}
catch(InvocationTargetException invocationtargetexception)
{
invocationtargetexception.printStackTrace();
}
catch(IllegalAccessException illegalaccessexception)
{
illegalaccessexception.printStackTrace();
}
}
private SuperDemo app;
private DemoDescription demoDescription;
public DisplayDemo(SuperDemo superdemo, DemoDescription demodescription)
{
app = superdemo;
demoDescription = demodescription;
}
}
static class PDFExportTask
implements Runnable
{
public void run()
{
try
{
SuperDemo.saveChartAsPDF(file, chart, width, height, new DefaultFontMapper());
}
catch(IOException ioexception)
{
ioexception.printStackTrace();
}
}
JFreeChart chart;
int width;
int height;
File file;
public PDFExportTask(JFreeChart jfreechart, int i, int j, File file1)
{
chart = jfreechart;
file = file1;
width = i;
height = j;
jfreechart.setBorderVisible(true);
jfreechart.setPadding(new RectangleInsets(2D, 2D, 2D, 2D));
}
}
public SuperDemo(String s)
{
super(s);
setContentPane(createContent());
setJMenuBar(createMenuBar());
}
private JComponent createContent()
{
JPanel jpanel = new JPanel(new BorderLayout());
JTabbedPane jtabbedpane = new JTabbedPane();
JPanel jpanel1 = new JPanel(new BorderLayout());
jpanel1.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
JSplitPane jsplitpane = new JSplitPane(1);
JTree jtree = new JTree(createTreeModel());
jtree.addTreeSelectionListener(this);
JScrollPane jscrollpane = new JScrollPane(jtree);
jscrollpane.setPreferredSize(new Dimension(300, 100));
jsplitpane.setLeftComponent(jscrollpane);
jsplitpane.setRightComponent(createChartDisplayPanel());
jpanel1.add(jsplitpane);
jtabbedpane.add("Demos", jpanel1);
MemoryUsageDemo memoryusagedemo = new MemoryUsageDemo(0x493e0);
(memoryusagedemo. new DataGenerator(1000)).start();//*******************8
jtabbedpane.add("Memory Usage", memoryusagedemo);
jtabbedpane.add("Source Code", createSourceCodePanel());
jtabbedpane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
jpanel.add(jtabbedpane);
return jpanel;
}
private JMenuBar createMenuBar()
{
JMenuBar jmenubar = new JMenuBar();
JMenu jmenu = new JMenu("File", true);
jmenu.setMnemonic('F');
JMenuItem jmenuitem = new JMenuItem("Export to PDF...", 112);
jmenuitem.setActionCommand("EXPORT_TO_PDF");
jmenuitem.addActionListener(this);
jmenu.add(jmenuitem);
jmenu.addSeparator();
JMenuItem jmenuitem1 = new JMenuItem("Exit", 120);
jmenuitem1.setActionCommand("EXIT");
jmenuitem1.addActionListener(this);
jmenu.add(jmenuitem1);
jmenubar.add(jmenu);
return jmenubar;
}
private JPanel createSourceCodePanel()
{
JPanel jpanel = new JPanel(new BorderLayout());
jpanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
JEditorPane jeditorpane = new JEditorPane();
jeditorpane.setEditable(false);
java.net.URL url = (demo.SuperDemo.class).getResource("source.html");
if(url != null)
try
{
jeditorpane.setPage(url);
}
catch(IOException ioexception)
{
System.err.println("Attempted to read a bad URL: " + url);
}
else
System.err.println("Couldn't find file: source.html");
JScrollPane jscrollpane = new JScrollPane(jeditorpane);
jscrollpane.setVerticalScrollBarPolicy(20);
jscrollpane.setPreferredSize(new Dimension(250, 145));
jscrollpane.setMinimumSize(new Dimension(10, 10));
jpanel.add(jscrollpane);
return jpanel;
}
public void actionPerformed(ActionEvent actionevent)
{
String s = actionevent.getActionCommand();
if(s.equals("EXPORT_TO_PDF"))
exportToPDF();
else
if(s.equals("EXIT"))
attemptExit();
}
private void exportToPDF()
{
java.awt.Component component = chartContainer.getComponent(0);
if(component instanceof ChartPanel)
{
JFileChooser jfilechooser = new JFileChooser();
jfilechooser.setName("untitled.pdf");
jfilechooser.setFileFilter(new FileFilter() {
public boolean accept(File file)
{
return file.isDirectory() || file.getName().endsWith(".pdf");
}
public String getDescription()
{
return "Portable Document Format (PDF)";
}
});
int i = jfilechooser.showSaveDialog(this);
if(i == 0)
{
ChartPanel chartpanel = (ChartPanel)component;
try
{
JFreeChart jfreechart = (JFreeChart)chartpanel.getChart().clone();
PDFExportTask pdfexporttask = new PDFExportTask(jfreechart, chartpanel.getWidth(), chartpanel.getHeight(), jfilechooser.getSelectedFile());
Sw
没有合适的资源?快使用搜索试试~ 我知道了~
JfreeChart1.03Demo源码
共546个文件
class:296个
java:248个
html:2个
需积分: 0 4 下载量 188 浏览量
2008-03-17
20:28:40
上传
评论
收藏 896KB RAR 举报
温馨提示
JfreeChart 1.03 Demo 源码,对于准备使用JFreeChart进行开发的同事来说,将会很有帮助。
资源推荐
资源详情
资源评论
收起资源包目录
JfreeChart1.03Demo源码 (546个子文件)
SuperDemo.class 34KB
DifferenceChartDemo2.class 26KB
XYBoxAnnotationDemo1.class 23KB
PriceVolumeDemo1.class 17KB
CombinedXYPlotDemo3.class 13KB
TimeSeriesDemo8.class 13KB
TimeSeriesDemo7.class 12KB
GanttRenderer2.class 10KB
CrosshairDemo2$DemoPanel.class 10KB
SurveyResultsDemo1.class 8KB
CrosshairDemo1$DemoPanel.class 8KB
ExtendedStackedBarRenderer.class 8KB
HighLowChartDemo2.class 7KB
MarkerDemo1.class 7KB
MarkerDemo2.class 7KB
OverlaidXYPlotDemo2.class 7KB
DualAxisDemo1.class 7KB
HighLowChartDemo1.class 7KB
AnnotationDemo1.class 7KB
CandlestickChartDemo1.class 7KB
StackedBarChartDemo4.class 7KB
DrawStringDemo.class 7KB
CylinderRenderer.class 6KB
CompassFormatDemo2$DemoPanel.class 6KB
AnnotationDemo2.class 6KB
DualAxisDemo2.class 6KB
BarChartDemo7.class 6KB
SurveyResultsDemo3.class 6KB
PerformanceTest1.class 6KB
StackedBarChartDemo2.class 6KB
ImageMapDemo3.class 6KB
PeriodAxisDemo1.class 6KB
DialDemo2$DemoPanel.class 6KB
CrosshairDemo3$DemoPanel.class 6KB
ChartPanelSerializationTest.class 6KB
DynamicDataDemo3$DemoPanel.class 6KB
CombinedXYPlotDemo4.class 6KB
MultipleAxisDemo1.class 6KB
ImageMapDemo6.class 6KB
LineChartDemo5.class 6KB
CombinedTimeSeriesDemo1.class 6KB
TranslateDemo1$DemoPanel.class 6KB
XYBarChartDemo5.class 6KB
OverlaidXYPlotDemo1.class 5KB
ParetoChartDemo1.class 5KB
QuarterDateFormatDemo.class 5KB
AreaChartDemo1.class 5KB
PeriodAxisDemo2.class 5KB
MouseListenerDemo3.class 5KB
ImageMapDemo7.class 5KB
DialDemo1$DemoPanel.class 5KB
CombinedXYPlotDemo1.class 5KB
TimeSeriesDemo11.class 5KB
DualAxisDemo3.class 5KB
XYBarChartDemo1.class 5KB
YieldCurveDemo.class 5KB
CategoryLabelPositionsDemo1.class 5KB
BarChartDemo3.class 5KB
LineChartDemo1.class 5KB
DynamicDataDemo2$DemoPanel.class 5KB
CombinedCategoryPlotDemo2.class 5KB
GanttDemo2.class 5KB
BarChartDemo9.class 5KB
SurveyResultsDemo2.class 5KB
MemoryUsageDemo.class 5KB
OverlaidBarChartDemo1.class 5KB
DialDemo5$DemoPanel.class 5KB
CombinedCategoryPlotDemo1.class 5KB
SerializationTest1.class 5KB
TimeSeriesDemo1.class 5KB
BarChartDemo10.class 5KB
CategoryPointerAnnotationDemo1.class 5KB
DualAxisDemo4.class 5KB
BarChartDemo5.class 5KB
TimeSeriesDemo13.class 5KB
CombinedXYPlotDemo2.class 5KB
MultipleDatasetDemo1.class 5KB
ImageMapDemo1.class 5KB
ImageMapDemo2.class 5KB
BarChartDemo1.class 5KB
GanttDemo1.class 5KB
BarChart3DDemo4.class 5KB
CompassFormatDemo1.class 5KB
MouseListenerDemo4.class 5KB
MultipleAxisDemo3.class 5KB
WaterfallChartDemo1.class 5KB
ItemLabelDemo5.class 5KB
TimePeriodValuesDemo1.class 5KB
XYAreaChartDemo1.class 5KB
ItemLabelDemo4.class 4KB
CategoryMarkerDemo2.class 4KB
XYBlockChartDemo3.class 4KB
ItemLabelDemo3.class 4KB
XYBlockChartDemo2.class 4KB
PeriodAxisDemo3.class 4KB
CategoryMarkerDemo1.class 4KB
MultipleAxisDemo2.class 4KB
LayeredBarChartDemo2.class 4KB
BarChartDemo8.class 4KB
LayeredBarChartDemo1.class 4KB
共 546 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
nmgfire007
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功