小编Sag*_*216的帖子

我的serialVersionUID之后为什么需要大括号?

我有一个语法错误,一行与serialVersionUID.要修复此错误,我必须在该行的末尾放置一个括号,并在我的代码末尾关闭它...我的问题是为什么?在包含Jframe的文件中没有必要这个...还有什么是serialVersionUID?我很抱歉,如果我的问题看起来很简单,我是编程的新手,对Java更新,这是我在GUI上的3天.

import javax.swing.*;


public class HangmanPanel extends JPanel{
    private static final long serialVersionUID = -1767262708330188227L;{

    this.setLayout(null);
    JLabel heading = new JLabel("Welcome to the Hangman App");
    JButton Button = new JButton("Ok");
    //get input

    JLabel tfLable = new JLabel("Please Enter a Letter:");
    JTextField text = new JTextField(10);


    heading.setSize(200, 50);
    tfLable.setSize(150, 50);
    text.setSize(50, 30);
    Button.setSize(60, 20);


    heading.setLocation(300, 10);
    tfLable.setLocation(50, 40);
    text.setLocation(50, 80);
    Button.setLocation(100, 85);

    this.add(heading);
    this.add(tfLable);
    this.add(text);
    this.add(Button);
}}
Run Code Online (Sandbox Code Playgroud)

java user-interface serialversionuid

0
推荐指数
1
解决办法
116
查看次数

标签 统计

java ×1

serialversionuid ×1

user-interface ×1