java 动态时钟问题
指尖逆苍穹 2012-11-07 09:13:16 import java.awt.Component;
import java.awt.event.*;
import javax.swing.*;
public class ClockAnimation extends JFrame {
private StillClock clock = new StillClock();
public ClockAnimation() {
add(clock);
Timer timer = new Timer(1000,new TimerListener());
timer.start();
}
private class TimerListener implements ActionListener {
public void actioPerformed(ActionEvent e) {
clock.setCurrentTime();
clock.repaint();
}
public static void main(String[] args) {
JFrame frame = new ClockAnimation();
frame.setTitle("ClockAnimation");
frame.setSize(200,200);
frame.setLocation(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
这个是动态时钟问题,add 和 StillClock 那两个地方总是报错
小弟菜鸟求大牛解释。。!