1 38 39 package org.jfree.chart.demo; 40 41 import java.awt.BasicStroke ; 42 import java.awt.Color ; 43 import java.awt.Insets ; 44 45 import org.jfree.chart.ChartPanel; 46 import org.jfree.chart.JFreeChart; 47 import org.jfree.chart.plot.ThermometerPlot; 48 import org.jfree.data.DefaultValueDataset; 49 import org.jfree.ui.ApplicationFrame; 50 51 56 public class ThermometerDemo2 extends ApplicationFrame { 57 58 63 public ThermometerDemo2(String title) { 64 65 super(title); 66 67 DefaultValueDataset dataset = new DefaultValueDataset(new Double (43.0)); 69 70 ThermometerPlot plot = new ThermometerPlot(dataset); 72 JFreeChart chart = new JFreeChart("Thermometer Demo 2", JFreeChart.DEFAULT_TITLE_FONT, 74 plot, false); 77 78 plot.setInsets(new Insets (5, 5, 5, 5)); 80 84 plot.setThermometerStroke(new BasicStroke (2.0f)); 85 plot.setThermometerPaint(Color.lightGray); 86 88 ChartPanel chartPanel = new ChartPanel(chart); 90 setContentPane(chartPanel); 91 92 } 93 94 105 110 public static void main(String [] args) { 111 112 ThermometerDemo2 demo = new ThermometerDemo2("Thermometer Demo 2"); 113 demo.pack(); 114 demo.setVisible(true); 115 116 } 117 118 } 119 | Popular Tags |