当前位置: 代码迷 >> J2SE >> not declare a static final serialVersionUID field,该如何解决
  详细解决方案

not declare a static final serialVersionUID field,该如何解决

热度:386   发布时间:2016-04-24 14:03:12.0
not declare a static final serialVersionUID field
package   doItMyself;

import   javax.swing.*;

public   class   ClockView   extends   JFrame{
private   JLabel   tLabel   =   new   JLabel();

ClockView(){
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setSize(95,   45);
this.getContentPane().add(tLabel);
this.refreshTimeDisplay();
}

protected   String   getDigitsAsString(int   i){
String   str=Integer.toString(i);
if   (i <10)   str= "0 "+str;
return   str;
}

public   void   refreshTimeDisplay(){
TimeStamp   t=   new   TimeStamp();
t.fillTimes();
String   display=getDigitsAsString(t.hrs)+ ": "+getDigitsAsString(t.mins)+ ": "+getDigitsAsString(t.secs);
tLabel.setText( "         "+display);
tLabel.repaint();
}
}
这段程序,报出一个警告错误:The   serializable   class   ClockView   does   not   declare   a   static   final   serialVersionUID   field   of   type   long

------解决方案--------------------
用工具自带的quick fix
直接在警告上面点右键就行了
  相关解决方案