import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;

/*
 ***************************************************************
 * Silly Sample program which demonstrates the basic paint
 * callback mechanism in the AWT.
 ***************************************************************
 */
public class Bezierova_Krivka {
    public static void main(String[] args) {
        Frame f2 = new Frame("Bonjour monsieur Bezier!");
        f2.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
        f2.add(new BezierCanvas(Color.magenta), BorderLayout.CENTER);
        f2.pack();
        f2.show();
    }
}

/**
 * A canvas which renders a smiley-face to the screen
 *
 * Note: Canvas is a heavyweight superclass, which makes
 * SmileyCanvas also heavyweight.  To convert this class to
 * a lightweight, change "extends Canvas" to "extends Component".
 */
class BezierCanvas extends Component {

    public BezierCanvas(Color faceColor) {
        setForeground(faceColor);
    }

    public Dimension getPreferredSize() {
        return new Dimension(300,300);
    }

   /*
    * Paint when the AWT tells us to...
    * CubicCurve2D .. Bezierova krivka
    */
   
    
    public void paint (Graphics gr) { 
  Graphics2D gr2 = (Graphics2D)gr; 
  //Shape c = new CubicCurve2D.Double(0,0,0,50,100,50,200,200); 
  Shape c1 = new CubicCurve2D.Double(16,146,83,65,68,344,125,225); 
  gr2.draw(c1);
  gr2.setColor(Color.green);
  Shape c2 = new QuadCurve2D.Double(16,146,83,65,125,225); 
  gr2.draw(c2);
  gr2.setColor(Color.red);
  } 

}



