import javax.swing.*; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.geom.*; public class QuadCurve2DTest2 extends JPanel{ public static void main(String[] args){ JFrame frame = new JFrame(); QuadCurve2DTest2 app = new QuadCurve2DTest2(); frame.getContentPane().add(app); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(10, 10, 300, 200); frame.setTitle("ƒ^ƒCƒgƒ‹"); frame.setVisible(true); } public void paintComponent(Graphics g){ Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); QuadCurve2D.Double curve = new QuadCurve2D.Double(); curve.setCurve(60.0d, 40.0d, 220.0d, 30.0d, 120.0d, 140.0d); g2.draw(curve); double x1 = curve.getX1(); double y1 = curve.getY1(); double x2 = curve.getX2(); double y2 = curve.getY2(); double ctrlx = curve.getCtrlX(); double ctrly = curve.getCtrlY(); g2.draw(new Ellipse2D.Double(x1 - 5.0d, y1 - 5.d, 10.d, 10.0d)); g2.draw(new Ellipse2D.Double(x2 - 5.0d, y2 - 5.d, 10.d, 10.0d)); g2.draw(new Ellipse2D.Double(ctrlx - 5.0d, ctrly - 5.d, 10.d, 10.0d)); } }