import java.awt.Dimension; import java.awt.Graphics2D; import javax.swing.JFrame; public class CourbeApplication { public static void creerInterface() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(400, 400)); frame.pack(); Graphics2D g = (Graphics2D) frame.getContentPane().getGraphics(); Courbe c1 = new Courbe(2, g, 400) { public double fonction(double x) { return 200. + 100. * Math.cos(x/20); } }; Courbe c2 = new Courbe(1, g, 400) { public double fonction(double x) { return 200. + 100. * Math.sin(x/20); } }; frame.setVisible(true); c1.start(); c2.start(); } public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { creerInterface(); } }); } }