package ui;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class JFrameGame extends JFrame{
ChessBorder chessBorder;
public ChessBorder getChessBorder()
{
	return chessBorder;
}
public JFrameGame(ChessBorder chessBorder)
{   
	this.chessBorder=chessBorder;
	this.setLayout(new BorderLayout());
	this.add(chessBorder,BorderLayout.CENTER);
	this.setTitle("五子棋");
	this.setSize(650,700);
	JButton jb_start=new JButton("开始");
    JButton jb_reset=new JButton("悔棋");
    JPanel content=new JPanel(new FlowLayout());
    content.add(jb_start);
    content.add(jb_reset);
    this.add(content,BorderLayout.SOUTH);
	this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	this.setLocationRelativeTo(null);
	this.setResizable(false);
	
	jb_start.addActionListener(new ActionListener(){

		@Override
		public void actionPerformed(ActionEvent e) {
		         chessBorder.restartGame();
		}
		
	});
}
public static void main(String[] args) 
{   
	ChessBorder chessBorder=new ChessBorder();
	JFrameGame frame=new JFrameGame(chessBorder);
	frame.setVisible(true);
}

}
最近下载更多
鲁一宇  LV5 2024年12月30日
kndxrt  LV1 2024年12月13日
qqqww11  LV2 2024年6月26日
wwuuuas  LV1 2024年6月3日
dexd1111  LV1 2024年5月28日
姜长志  LV1 2024年5月5日
anzai123  LV3 2024年2月29日
YYZQ编程  LV1 2023年12月28日
3大沙发  LV1 2023年12月20日
126577126  LV1 2023年6月18日
最近浏览更多
2601581358  LV1 3月31日
鲁一宇  LV5 2024年12月30日
yzhsnjdn  LV1 2024年12月17日
Jarway 2024年12月16日
暂无贡献等级
kndxrt  LV1 2024年12月13日
qqqww11  LV2 2024年6月26日
azzzz1  LV2 2024年6月26日
wwuuuas  LV1 2024年6月3日
A2220617643 2024年6月2日
暂无贡献等级
dexd1111  LV1 2024年5月28日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友