大家好,我需要以粗体绘制曲线,主要是那些以 N - S 开头的曲线,如果可能的话,那些曲线会得到 350-10 340-20 等等。我已经尝试过 QuadCurve2D 和 drawArc,但这些都不起作用。有什么办法可以避免使用 drawPolyline(xPoints, yPoints, WIDTH) 因为只画一条线需要数百对。
这是代码的一部分,以避免您浪费时间测试自己:
public class PaintMyQuad extends JPanel {
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g.create();
QuadCurve2D.Double curve = new QuadCurve2D.Double(200,0,200,100,200,200);
QuadCurve2D.Double curve1 = new QuadCurve2D.Double(200,0,180,100,200,200);
QuadCurve2D.Double curve2 = new QuadCurve2D.Double(200,0,160,100,200,200);
//etc
g2d.setColor(Color.RED);
g2d.draw(curve);
g2d.draw(curve1);
g2d.draw(curve2);
g2d.drawOval(100,100,200,200);
g2d.drawArc(100,100, 100, 200, 90, 180);
g2d.drawArc(100, 100, 100, 200, 180, 360);
g2d.drawArc(100, 100, 0, 200, 90, 180);
g2d.drawRect(100, 100, 200, 200);