覆盖Canvas类的update(Graphics g)方法,改成这样    public void update(Graphics g) {
        paint(g);
    }