麻烦高手帮忙看一下是哪里的问题,
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.text.*;
public class Clock extends JFrame {
int x,y,old_X,old_Y,r,x0,y0,w,h,ang;
int sdo,mdo,hdo,old_M,old_H;
final double RAD = Math.PI/180.0;
public Clock(){
super("动画时钟");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(320,360);
setBackground(Color.white);
setResizable(false);
setVisible(true);
int delay = 500;
ActionListener taskPerformer = new ActionListener() {
public void actionPerformed(ActionEvent evt){
repaint();
}
};
new Timer(delay,taskPerformer).start();
}
public void paint(Graphics g){
super.paint(g);
Insets insets= getInsets();
int L0= (insets.left)/2,T0=(insets.top)/2;
int hh,mm,ss;
h = getSize().height-40;
Graphics2D g2d=(Graphics2D) g;
g2d.setStroke(new BasicStroke(3.0f));
g2d.setColor(Color.black);
r=h/2-30;
g2d.drawOval(L0+30,T0+30,2*r,2*r);
x0=30+r-5+L0;
y0=30+r-5+T0;
ang=60;
g2d.setColor(new Color(255,106,66));
g2d.setFont(new Font("宋体",Font.PLAIN,15));
for (int i=1;i<=12;i++){
x=(int) ((r+10)*Math.cos(RAD*ang)+x0);
y=(int) ((r+10)*Math.sin(RAD*ang)+y0);
g2d.drawString(""+i,x,h-y);
ang-=30;
}
x0=30+r+L0;
y0=30+r+T0;
Calendar noe = Calendar.getInstance();
@ hh=now.get(Calendar.HOUR_OF_DAY);
@ mm=now.get(Calendar.MINUTE);
@ ss=now.get(Calendar.SECOND);
sdo = 90-ss*6;
mdo = 90-mm*6;
hdo = 90-hh*30-mm/2;
g2d.setColor(Color.red);
x=(int)((r-8)*Math.cos(RAD*sdo)+x0);
y=(int)((r-8)*Math.sin(RAD*sdo)+y0)-2*T0;
g2d.drawLine(x0,y0,x,(h-y));
old_X= x;
old_Y= y;
line(g2d,mdo,(int)(r*0.7),Color.green);
line(g2d,hdo,(int)(r*0.6),Color.blue);
SimpleDateFormat fmat = new SimpleDateFormat("s",Locale.getDefault());
fmat.applyPattern("YYYY年MM月DD日 EEE HH:mm:ss");
g.drawString(fmat.format(new Date()),L0,h+25);
}
public void line(Graphics g,int t,int len,Color c){
int[] xp = new int[4];
int[] yp = new int[4];
xp[0] = x0;
yp[0] = y0;
xp[1] = (int) ((len-10)*Math.cos(RAD*(t-4))+x0);
xp[1] = h-(int) ((len-10)*Math.sin(RAD*(t-4))+ y0);
xp[2] = (int) (len*Math.cos(RAD*t)+x0);
xp[2] = h-(int)(len*Math.sin(RAD*t)+y0);
xp[3] = (int) ((len-10)*Math.cos(RAD*(t+4))+x0);
xp[3] = h-(int) ((len-10)*Math.sin(RAD*(t+4))+ y0);
g.setColor(c);
g.fillPolygon(xp,yp,4);
}
public static void main(String args[]){
new Clock();
}
}报错其中Timer引用不明确,然后三个@标注地方是找不到符号,不明白怎么回事呀?