要求是让这段代码画出的同心圆动画一直重复下去
```import javax.swing.*;
import java.awt.*;
public class SimpleAnimation {
JFrame frame;
MyDrawPanel drawPanel;
JTextField txField ;
static int ringNumber;
public static void main (String[] args) {
SimpleAnimation gui = new SimpleAnimation (0,0);
ringNumber=Integer.parseInt(JOptionPane.showInputDialog(null,"input ring numbers"));
gui.go();
}
public SimpleAnimation(int x,int y) {
frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// txField = new JTextField(10);
drawPanel = new MyDrawPanel(x,y);
// frame.getContentPane().add(txField, BorderLayout.SOUTH);
frame.getContentPane().add(drawPanel,BorderLayout.CENTER);
/*
txField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ringNumber = Integer.parseInt(txField.getText());
go();
}
});不能在回调方法中使用线程
*/
frame.setSize(300,300);
frame.setVisible(true);
}
public void go() {
for (int i = 0; i < ringNumber; i++) {
drawPanel.x=drawPanel.x+1;
drawPanel.y=drawPanel.y+1;
drawPanel.repaint();
try { Thread.sleep(50); } catch(Exception ex) { } }
}// close go() method
class MyDrawPanel extends JPanel {
int x, y;
public MyDrawPanel(int x, int y) {
this.x = x;
this.y = y;
}
public void paintComponent(Graphics g) {
// g.setColor(Color.white);
// g.fillRect(0,0,this.getWidth(), this.getHeight());
g.setColor(Color.green);
g.drawOval(100-x,130-y,40+2*x,40+2*y);
}
} // close inner class
} // close outer class