import javax.swing.*;

public class JButtonTest1 {
    public static void main(String[] args) {
        JFrame frame=new JFrame();
        frame.setSize(500,500);
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        //关闭窗体的默认布局方式
        frame.setLayout(null);
        //创建按钮对象
        JButton button=new JButton("按钮");
        //设置按钮的摆放位置和宽高
        button.setBounds(100,100,100,100);
        //将按钮添加到窗体的面板对象当中
        frame.getContentPane().add(button);

        frame.setVisible(true);
    }
}