LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1078|回复: 1

在Eclipse中的警告

[复制链接]
发表于 2005-12-16 11:02:54 | 显示全部楼层 |阅读模式
  1. The serializable class PaintPad does not declare a static final  serialVersionUID field of type long
复制代码

代码如何写才能避免以上警告?
付代码:

  1. import java.awt.*;
  2. import javax.swing.*;

  3. public class PaintPad extends JFrame
  4. {
  5.         JButton jbt=new JButton("OOOKKKK");
  6.         public PaintPad()
  7.         {
  8.                 getContentPane().setLayout(new FlowLayout());
  9.                 getContentPane().add(jbt);
  10.         }
  11.         public static void main(String[] args)
  12.         {
  13.                 PaintPad f=new PaintPad();
  14.                 f.setSize(100,100);
  15.                 f.setVisible(true);
  16.         }
  17. }
复制代码
发表于 2006-1-4 12:22:24 | 显示全部楼层
在左边有一个提示符得
点击就可以得到提示
然后生成一个serialVersionUID 就可行了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表