|
From: Nathaniel G. A. <nat...@ya...> - 2004-04-01 01:54:13
|
Does the original code work for you?
--- Leonid Asanov <leo...@ho...> wrote:
> I'm trying to adapt SwingDemo for working within JApplet, but can't make it
> display anything.
> Could you look at my code and tell what is wrong with it?
> Thank you!
>
> ____
>
> import org.jCharts.chartData.ChartDataException;
> import org.jCharts.chartData.PieChartDataSet;
> import org.jCharts.nonAxisChart.PieChart2D;
> import org.jCharts.properties.*;
>
> import javax.swing.*;
> import java.awt.*;
> import java.awt.event.WindowEvent;
> import java.awt.image .*;
>
>
> public class AppletTest extends JApplet
> {
> private JPanel panel;
> private PieChart2D pieChart2D;
> private BufferedImage bufferedImage;
>
> public AppletTest() {
> try {
> initComponents();
> } catch(Exception e) {};
> }
>
> public void init() {
> this.panel.getGraphics().drawImage(bufferedImage,0,0,this);
> }
>
> public void start() {
> // this.panel.getGraphics().drawImage(bufferedImage,0,0,this);
> }
>
>
> public void initComponents() throws ChartDataException, PropertyException
> {
> this.panel=new JPanel( true );
> this.panel.setSize( 500, 500 );
> this.getContentPane().add( this.panel );
>
> String[] labels={"BMW", "Audi", "Lexus"};
> String title="Cars that Own";
> Paint[] paints={Color.blue, Color.gray, Color.red};
> double[] data={50d, 30d, 20d};
>
> PieChart2DProperties pieChart2DProperties=new PieChart2DProperties();
> PieChartDataSet pieChartDataSet=new PieChartDataSet( title, data, labels,
> paints, pieChart2DProperties );
>
> pieChart2D=new PieChart2D( pieChartDataSet, new LegendProperties(), new
> ChartProperties(), 450, 450 );
>
> bufferedImage=new BufferedImage( 450, 450, BufferedImage.TYPE_INT_RGB );
> pieChart2D.setGraphics2D( bufferedImage.createGraphics() );
> pieChart2D.render();
> }
> }
>
>
> Regards,
> Leo Asanov
>
> _________________________________________________________________
> Personalise your phone with chart ringtones and polyphonics. Go to
> http://ringtones.com.au/ninemsn/control?page=/ninemsn/main.jsp
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> jCharts-users mailing list
> jCh...@li...
> https://lists.sourceforge.net/lists/listinfo/jcharts-users
__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
|