請問我想在窗口添加一個按鈕怎么寫
package com.mch0dm1n.seticom;
import javax.swing.JButton;
import javax.swing.JFrame;
public class chuangkou extends JFrame {
public chuangkou() {
this.setTitle("智偉創(chuàng)造");
this.setBounds(300, 200, 580, 600);
this.setSize(580, 600);
this.setLocation(300, 200);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
this.setLocationRelativeTo(null);// 為null,啟動程序時窗口將置于屏幕的中央
JButton diamondsButton[][] = new JButton[6][5];//游戲按鈕數(shù)組?
}
public static void main(String[] args) {
new chuangkou();
}
}
2018-08-20
你的按鈕沒有加入到窗口中。
this.add(Button);