这是一个临时的“SSCCE”......
import java.awt.;
import java.awt.geom.;
import javax.swing.*;
public class myApp extends JFrame{
private JPanel myPanel;
private JButton myButton;
private Ellipse2D e[];
public myApp(){
//the objects I need to draw
e = new Ellipse2D.Double[2];
e[0] = new Ellipse2D.Double(50.0, 50.0, 50.0, 50.0);
e[1] = new Ellipse2D.Double(120.0, 120.0, 50.0, 50.0);
//--------------------------
setSize(400,300);
myPanel = new JPanel(new BorderLayout());
myButton = new JButton("Fire");
setLayout(new BorderLayout());
this.add(myPanel, BorderLayout.SOUTH);
this.add(myButton, BorderLayout.NORTH);
}
public static void main(String args[]) {
myApp my = new myApp();
my.setVisible(true);
}
}
问题不仅在于我不知道如何使用计时器类,而且我也不知道在计时器将重复调用的方法中放入什么,以便我可以获得动画..!