📜  java gui - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:02.835000             🧑  作者: Mango

代码示例3
import javax.swing.*;
class main {
    public static void main(String args[]){
       JFrame frame = new JFrame("Hello World");
       frame.setSize(300,300)
         JButton button = new JButton("You should totally click me");
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       frame.getContentPane().add(button); // Adds Button to content pane of frame
       frame.setVisible(true);
    }
}