为什么这段Java代码无法运行??

来源:百度知道 编辑:UC知道 时间:2024/05/16 02:39:00
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.util.*;
import javax.swing.*;
import javax.swing.Timer;
class ClockDemo extends JFrame {
public ClockDemo(){
setSize(400,400);
this.getContentPane().setBackground(Color.blue);
this.getContentPane().add(new clock(),"center");
setTitle("时钟演示");
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
public static void main(String args[])
{
JFrame.setDefaultLookAndFeelDecorated(true);
ClockDemo mainFrame = new ClockDemo();
}

}
class clock extends JPanel{
Thread timer;
int oldh=-1,oldm=-1,olds=-1,hq=-1,mq=-1,sq=-1;
final double RAD=Math.PI/180.0;
public clock(){
super();
this.setOpaque(false);
ActionListener taskPerformer=new ActionListener(){
public void actionPerformed(ActionEvent evt){

错误1
#setTitle("时钟演示"); 你的分号是汉语标点!
错误二
import java.awt.geom.*; 该 ClockDemo.java 使用或覆盖了已过时的 API。
注意: 要了解详细信息,请使用 -Xlint:deprecation 重新编译。