Realisation d'un graphique
Bonjour tout le monde
J'ai en projet pour cette année de réaliser un graphique en java.
Mon probleme est que le jpanel ne s'affiche pas.
Voici le code.
Code:
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
|
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Image.*;
import java.awt.Color.*;
public class CompoFonction extends JPanel implements ActionListener
{
JPanel graph;
JButton calculer;
JButton quitter;
public CompoFonction() {
GridBagLayout gridbag = new GridBagLayout();
this.setLayout(gridbag);
JLabel titre = new JLabel("Calcul intégrale");
titre.setForeground(Color.red);
Font titrefon = titre.getFont();
titrefon = titrefon.deriveFont(Font.BOLD).deriveFont(16f);
titre.setFont(titrefon);
GridBagConstraints titr = new GridBagConstraints();
titr.gridx=1;
titr.gridy=0;
titr.gridwidth=1;
titr.gridheight=1;
titr.weightx=0;
titr.weighty=0;
titr.insets = new Insets(4,4,4,4);
gridbag.setConstraints(titre, titr);
this.add(titre);
graph = new JPanel();
GridBagConstraints graphique = new GridBagConstraints();
graphique.gridx=1;
graphique.gridy=1;
graphique.gridwidth=1;
graphique.gridheight=1;
graphique.weightx=10;
graphique.weighty=20;
graphique.insets = new Insets(4,4,4,4);
gridbag.setConstraints(graph, graphique);
this.add(graph);
}
public void actionPerformed(ActionEvent evt) {
}
} |
Que manque t'il pour afficher le jpanel.