From 28dd145663bc8ffe2923843cc74cc8c48a546e12 Mon Sep 17 00:00:00 2001 From: pfuev32l6 <2433689268@qq.com> Date: Sat, 13 Apr 2024 18:35:34 +0800 Subject: [PATCH] ADD file via upload --- src/GameFrame.java | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/GameFrame.java diff --git a/src/GameFrame.java b/src/GameFrame.java new file mode 100644 index 0000000..fe3ad06 --- /dev/null +++ b/src/GameFrame.java @@ -0,0 +1,64 @@ +package xxl; + +import javax.swing.*; + + + + public class GameFrame extends JFrame { + private static final long serialVersionUID = 1L; + GamePanel panel; + + + /** + * GameFrame构造方法 + */ + public GameFrame() { + // 设置窗体标题 + setTitle("数字连连消"); + //位置 + int x=100,width=700,height=700,y=100; + // 设置窗体位置和大小 + setBounds(x, y, width, height); + // 设置窗体不能改变大小 + setResizable(false); + // 设置窗体居中显示 + setLocationRelativeTo(null); + // 设置窗体关闭即退出 + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + panel = new GamePanel(); + add(panel); + // 最后显示窗体 + setVisible(true); + } + + public GameFrame(int c){ + if(c!=0){ + // 设置窗体标题 + setTitle("数字连连消"); + //位置 + int x=100,width=900,height=900,y=100; + // 设置窗体位置和大小 + setBounds(x, y, width, height); + // 设置窗体不能改变大小 + setResizable(false); + // 设置窗体居中显示 + setLocationRelativeTo(null); + // 设置窗体关闭即退出 + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + panel = new GamePanel(); + add(panel); + // 最后显示窗体 + setVisible(true); + } + } + /** + * 启动游戏 + */ + public void start() { + panel.start(); + } + public void start2(){panel.start2();} + public void start3(){panel.start3();} + + } +