import java.awt.*; import java.awt.geom.*; import javax.swing.*; /** * Constructs the graphics for the graphing of the curve. * * @author Chris Abella * @version 1.0 */ public class BezierGrapher extends JFrame { private Stroke thickness; private CubicCurve2D bezier; public BezierGrapher(double x1, double y1, double ctrX1, double ctrY1, double ctrX2, double ctrY2, double x2, double y2, int width) { int yShift = 25; bezier = new CubicCurve2D.Double(x1, y1 + yShift, ctrX1, ctrY1 + yShift, ctrX2, ctrY2 + yShift, x2, y2 + yShift); thickness = new BasicStroke(width); } public void paint(Graphics g) { Graphics2D g2 = (Graphics2D)g; g2.clearRect(0,0,100000,100000); g2.setStroke(thickness); g2.draw(bezier); } }