如何用 Java 语言制作合适的 JFrame?

How to make a proper JFrame in Java Language?

Hello community! I am very new to Java language and need help to make JFrame work. I believe that the code posted below is wrong as it terminates. I am using the text editor Eclipse. Please help as I cannot find what the problem is. Thanks!

import javax.swing.JFrame;


public class Game extends JFrame {
/**
 * 
 */
private static final long serialVersionUID = 1L;
public void run(){
    setVisible(true);
    setTitle("Good");
    setSize(900,500);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {


}

 }

在您的例子中,main() 方法应该如下所示:

public static void main(String[] args) {
Game game = new Game();
game.run(); 
}