Bonjour,
Je voudrais insérer un JFreeChart (http://www.tutorialspoint.com/jfreec...line_chart.htm) dans un JPanel. J'ai essayé de faire :
Mais j'ai une erreur à la compilation :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 JPanel pan = new JPanel(); pan.setSize(200, 150); pan.setBackground(Color.ORANGE); panel.add(pan, BorderLayout.WEST); setContentPane(panel); JFreeChart lineChart = ChartFactory.createLineChart("graphe","Years","Number of Schools",createDataset(),PlotOrientation.VERTICAL,true,true,false); panel.add(lineChart, BorderLayout.WEST); setContentPane(panel);
Ce n'est juste pas possible de faire ça ou je le fais mal ? Au pire je fais dans une autre fenetre mais ça serait vraiment mieux de pouvoir le mettre dans mon panel...
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 Interface.java:73: error: no suitable method found for add(JFreeChart,String) panel.add(lineChart, BorderLayout.WEST); ^ method Container.add(Component,Object,int) is not applicable (actual and formal argument lists differ in length) method Container.add(Component,Object) is not applicable (actual argument JFreeChart cannot be converted to Component by method invocation conversion) method Container.add(Component,int) is not applicable (actual argument JFreeChart cannot be converted to Component by method invocation conversion) method Container.add(String,Component) is not applicable (actual argument JFreeChart cannot be converted to String by method invocation conversion) method Container.add(Component) is not applicable (actual and formal argument lists differ in length) method Component.add(PopupMenu) is not applicable (actual and formal argument lists differ in length) 1 error
Merci d'avance pour votre aide.
Partager