Bonjour, je voudrais convertir une application java en applet. Je sias qu'il faut appelr le package applet et remplacer le main par la fonction init(), mais il y a d'autres choses à faire et je ne sias plus lequels...
J'avais un cours sur cela mais je ne le trouve plus

Voici mon application
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
 
import java.awt.*;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
import javax.swing.JPanel;
import org.jfree.chart.*;
import org.jfree.chart.axis.PeriodAxis;
import org.jfree.chart.axis.PeriodAxisLabelInfo;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.data.time.*;
import org.jfree.data.xy.XYDataset;
import org.jfree.ui.*;
 
public class Graphique extends ApplicationFrame
{
 
    public Graphique(String s)
    {
        super(s);
        XYDataset xydataset = createDataset();
        JFreeChart jfreechart = createChart(xydataset);
        ChartPanel chartpanel = new ChartPanel(jfreechart);
        chartpanel.setPreferredSize(new Dimension(500, 270));
        chartpanel.setMouseZoomable(true, false);
        setContentPane(chartpanel);
    }
 
    private static JFreeChart createChart(XYDataset xydataset)
    {
        JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Legal & General Unit Trust Prices", "Date", "Price Per Unit", xydataset, true, true, false);
        jfreechart.setBackgroundPaint(Color.white);
        XYPlot xyplot = (XYPlot)jfreechart.getPlot();
        xyplot.setBackgroundPaint(Color.lightGray);
        xyplot.setDomainGridlinePaint(Color.white);
        xyplot.setRangeGridlinePaint(Color.white);
        xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
        xyplot.setDomainCrosshairVisible(true);
        xyplot.setRangeCrosshairVisible(true);
        org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer();
        if(xyitemrenderer instanceof XYLineAndShapeRenderer)
        {
            XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer)xyitemrenderer;
            xylineandshaperenderer.setShapesVisible(true);
            xylineandshaperenderer.setShapesFilled(true);
            xylineandshaperenderer.setItemLabelsVisible(true);
        }
        PeriodAxis periodaxis = new PeriodAxis("Date");
        periodaxis.setTimeZone(TimeZone.getTimeZone("Pacific/Auckland"));
        periodaxis.setAutoRangeTimePeriodClass(org.jfree.data.time.Day.class);
        PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[3];
        aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("d"));
        aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Month.class, new SimpleDateFormat("MMM"), new RectangleInsets(2D, 2D, 2D, 2D), new Font("SansSerif", 1, 10), Color.blue, false, new BasicStroke(0.0F), Color.lightGray);
        aperiodaxislabelinfo[2] = new PeriodAxisLabelInfo(org.jfree.data.time.Year.class, new SimpleDateFormat("yyyy"));
        periodaxis.setLabelInfo(aperiodaxislabelinfo);
        xyplot.setDomainAxis(periodaxis);
        return jfreechart;
    }
 
    private static XYDataset createDataset()
    {
        TimeSeries timeseries = new TimeSeries("Ph jonction");
        timeseries.add(new Day(1, 1, 2007), 7.85D);
        timeseries.add(new Day(2, 1, 2007), 7.9D);
        timeseries.add(new Day(3, 1, 2007), 8.2D);
        timeseries.add(new Day(4, 1, 2007), 8.05D);
        timeseries.add(new Day(5, 1, 2007), 7.85D);
        timeseries.add(new Day(6, 1, 2007), 7.65D);
        timeseries.add(new Day(7, 1, 2007), 7.75D);
        timeseries.add(new Day(8, 1, 2007), 8.19D);
        timeseries.add(new Day(9, 1, 2007), 7.7D);
        timeseries.add(new Day(10, 1, 2007), 7.9D);
        timeseries.add(new Day(11, 1, 2007), 7.9D);
        timeseries.add(new Day(12, 1, 2007), 7.7D);
        timeseries.add(new Day(13, 1, 2007), 7.6D);
        timeseries.add(new Day(14, 1, 2007), 7.8D);
        timeseries.add(new Day(15, 1, 2007), 7.8D);
        timeseries.add(new Day(16, 1, 2007), 7.8D);
        timeseries.add(new Day(17, 1, 2007), 7.9D);
        timeseries.add(new Day(18, 1, 2007), 9.45D);
 
        timeseries.add(new Day(19, 1, 2007), 7.65D);
        timeseries.add(new Day(20, 1, 2007), 7.85D);
        timeseries.add(new Day(21, 1, 2007), 7.7D);
        timeseries.add(new Day(22, 1, 2007), 8D);
        timeseries.add(new Day(23, 1, 2007), 8D);
        timeseries.add(new Day(24, 1, 2007), 7.8D);
        timeseries.add(new Day(25, 1, 2007), 8.05D);
        timeseries.add(new Day(26, 1, 2007), 8.05D);
        timeseries.add(new Day(27, 1, 2007), 8D);
        timeseries.add(new Day(28, 1, 2007), 8.15D);
        timeseries.add(new Day(29, 1, 2007), 8.05D);
        timeseries.add(new Day(30, 1, 2007), 8.15D);
        timeseries.add(new Day(31, 1, 2007), 7.95D);
 
        TimeSeries timeseries1 = new TimeSeries("Limite de contrôle +");
        timeseries1.add(new Day(1, 1, 2007), 8.9D);
        timeseries1.add(new Day(31, 1, 2007), 8.9D);
        TimeSeries timeseries2 = new TimeSeries("Limite de contrôle -");
        timeseries2.add(new Day(1, 1, 2007), 6.99D);
        timeseries2.add(new Day(31, 1, 2007), 6.99D);
 
 
        TimeZone timezone = TimeZone.getTimeZone("Pacific/Auckland");
        TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(timezone);
        timeseriescollection.addSeries(timeseries);
 
         timeseriescollection.addSeries(timeseries1);
 
         timeseriescollection.addSeries(timeseries2);
 
        timeseriescollection.setXPosition(TimePeriodAnchor.MIDDLE);
        return timeseriescollection;
    }
 
    public static JPanel createDemoPanel()
    {
        JFreeChart jfreechart = createChart(createDataset());
        return new ChartPanel(jfreechart);
    }
 
    public static void main(String args[])
    {
        Graphique periodaxisdemo2 = new Graphique("Vérification de la normalité");
        periodaxisdemo2.pack();
        RefineryUtilities.centerFrameOnScreen(periodaxisdemo2);
        periodaxisdemo2.setVisible(true);
    }
}
Merci de votre réponse