while (playing) 
{
//playing在play中已经设为真
if (block != null) 
{    //第一次循环时,block为空,块类的对象
if (block.isAlive()) 
{
try 
{
Thread.currentThread().sleep(100);
} catch (InterruptedException ie) 
{
ie.printStackTrace();
}
continue;
}
}
语句:Thread.currentThread().sleep(100);报错 说是:应该以静态方式访问thread中的静态方法sleep(long) 该怎么改呢?
    public class GameCanvas extends JPanel{}
   这个类未声明类型为long的静态终止serialversion  uid字段           如何解决?

解决方案 »

  1.   

    语句:Thread.currentThread().sleep(100);报错   说是:应该以静态方式访问thread中的静态方法sleep(long)   该怎么改呢? 
    修改为Thread.sleep(100);
            public   class   GameCanvas   extends   JPanel{} 
          这个类未声明类型为long的静态终止serialversion     uid字段                       如何解决?
    这应该是一个警告,随便定义一个或者忽略都可以。
    在Eclipse中点左键甚至可以提供三种自动解决方法。
      

  2.   

    直接Thread.sleep();不就行了
    http://www.10zhizui.cn