public void paint(Graphics g){

}
该成public void paintComponents(Graphics g){

}

解决方案 »

  1.   

    我是按一个半圆一个半圆连接起来画的,应该有专门做螺旋曲线的算法,最好的算法还是看看图形学的书吧,先给出我的画的方法: public void drawHelixCurve(Graphics g)
    {
    g.setColor(Color.red); Point startP = new Point();
    Point endP = new Point();
    int n = 10;
    startP.x = getSize().width/2 - 10;
    startP.y = getSize().height/2 - 10;
    endP.x = 20;
    endP.y = 20; for (int i=1; i<=20; i++)
    {
    if (i % 2 == 0)
    {
    startP.y = startP.y - n;
    endP.x += 2 * n;
    endP.y += 2 * n;
    g.drawArc(startP.x,  startP.y,  endP.x,  endP.y,  0, -180);
    }
    else
    {
    startP.x = startP.x - 2 * n;
    startP.y = startP.y - n;
    endP.x += 2 * n;
    endP.y += 2 * n;
    g.drawArc(startP.x,  startP.y,  endP.x,  endP.y,  0, 180);
    }
    }
    }
      

  2.   

    完整程序祥见:http://www2.opensource.com.cn/**********************************
    征集代码范例,文章,译文
    http://www2.opensource.com.cn/
    **********************************