问题The serializable class PaintFrame does not declare a static final serialVersionUID field of type long

工具为vscode,尝试创建一个居中的窗口时显示一个问题

The serializable class PaintFrame does not declare a static final ser1 / c W F T C QialVersionUID field of type long Java(536871008) [6, 14]

上网查了一下,都说是EclipseR _ k6 r 1 t问题,但我用的是vscode,所以比较懵圈

import java.awt.Dimension;
import javN Y n H Sax.swing.JButton;
import javax.swing.JFrame;
public class PaintFrame extends JFrame{
public static void main(Sw J f : B Jtring[] args) {
new PaintFrame();
}
public PaintFrame() {
int wi+ N % m )ndowX j L W wWidth = 1600;
int windowHeij ^ Sght = 900;
Dimension d = new Toolkit.getDefaultToolkit().getScreenSize();
int screenWidth = d.width;
int screenHeight = d.height;
setTi& C n { ] ]tle("画板");
setSize(windowWidth, winJ ^ ^dowHeight);
setResizable(false);
setDefaultCloseOperation(EXIT_ON+ E z {_CLOSE);
setLocation((screenWidth - windowWidth) / 2, (screenHeight - windowHeight) / 2);
}
}

回答

根据提示可先在public static void main前加上类似如下代码

 private static final long serialVersionUID = -3206065828593806732L;