1

当我运行下面的程序时,netBeans 报告“一个或多个项目编译时出现错误”,但没有说明这些错误是什么。但是,它接着说构建成功并且根据需要绘制了贝塞尔曲线。有谁知道 a) 决定报告有错误但没有说明错误是什么的决定背后的想法是什么?b)如何找出错误是什么?

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package curve2;

/**
 *
 * @author User
 */
import java.awt.*;
    import java.util.*;
    import java.awt.geom.Point2D;
    import java.awt.geom.CubicCurve2D;
        import org.jfree.ui.ApplicationFrame;

public class Curve2 extends ApplicationFrame {
        // Set control points
        private int x1 = 200;
        private int y1 = 200;

        private int ctrlx = 300;
        private int ctrly = 300;

        private int x2 = 300;
        private int y2 = 500;

        // Construct frame
        public Curve2() {
              super("First Bezier Curve");
        setSize(600, 600);
            //centre();
            setVisible(true);
        }

        public void paint(Graphics g) {
            // Set points
            Point2D.Double P1 = new Point2D.Double(50, 75); // Start Point
        Point2D.Double P2 = new Point2D.Double(150, 75); // End Point
            Point2D.Double ctrl1 = new Point2D.Double(80, 25); // Control Point 1
            Point2D.Double ctrl2 = new Point2D.Double(160, 100); // Control Point 2


            CubicCurve2D.Double cubicCurve; // Cubic curve

            cubicCurve = new CubicCurve2D.Double( P1.x, P1.y, ctrl1.x, ctrl1.y, ctrl2.x, ctrl2.y, P2.x, P2.y);

            Graphics2D g2 = (Graphics2D)g;
            g2.draw(cubicCurve);
        }
4

0 回答 0