資源簡介
用java實現的掃雷小游戲,包括源代碼,圖片,打包后文件
代碼片段和文件信息
package?game;
import?java.awt.BorderLayout;
import?java.awt.GridLayout;
import?java.awt.Image;
import?java.awt.Insets;
import?java.awt.Toolkit;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?java.awt.event.MouseEvent;
import?java.awt.event.MouseListener;
import?javax.swing.ImageIcon;
import?javax.swing.JButton;
import?javax.swing.Jframe;
import?javax.swing.JLabel;
import?javax.swing.JMenu;
import?javax.swing.JMenuBar;
import?javax.swing.JMenuItem;
import?javax.swing.JOptionPane;
import?javax.swing.JPanel;
import?javax.swing.WindowConstants;
public?class?Main?implements?MouseListener?{
private?int?levels[][]?=?{?{?10?10?10?}?{?15?15?15?}?{?20?20?20?}?};//?等級內容
private?final?int?D?=?23;
private?Jframe?jf?=?new?Jframe(“掃雷“);//?主窗體
private?int?back[][];//?底層數據
private?JPanel?map?=?new?JPanel();//?地圖面板
private?JButton?buttons[][];//?按鈕組
private?int?row;//?當前行數
private?int?col;//?當前列數
private?int?bombNum;//?當前地雷數
//?創建圖片
private?Toolkit?tool?=?Toolkit.getDefaultToolkit();
private?Image?one?=?tool.getImage(this.getClass().getResource(“/images/6.jpg“));
private?Image?two?=?tool.getImage(this.getClass().getResource(“/images/7.jpg“));
private?Image?three?=?tool.getImage(this.getClass().getResource(“/images/8.jpg“));
private?Image?four?=?tool.getImage(this.getClass().getResource(“/images/9.jpg“));
private?Image?five?=?tool.getImage(this.getClass().getResource(“/images/10.jpg“));
private?Image?six?=?tool.getImage(this.getClass().getResource(“/images/11.jpg“));
private?Image?seven?=?tool.getImage(this.getClass().getResource(“/images/12.jpg“));
private?Image?eight?=?tool.getImage(this.getClass().getResource(“/images/13.jpg“));
private?Image?bomb?=?tool.getImage(this.getClass().getResource(“/images/1.jpg“));
private?Image?victory?=?tool.getImage(this.getClass().getResource(“/images/2.jpg“));
private?Image?question?=?tool.getImage(this.getClass().getResource(“/images/4.jpg“));
private?Image?flag?=?tool.getImage(this.getClass().getResource(“/images/3.jpg“));
private?Image?blank?=?tool.getImage(this.getClass().getResource(“/images/blank.jpg“));
//?主方法
public?static?void?main(String[]?args)?{
//?TODO?Auto-generated?method?stub
new?Main();
}
//?構造函數
Main()?{
row?=?levels[0][0];
col?=?levels[0][1];
bombNum?=?levels[0][2];
initialize();
}
//?設置主窗體
private?void?initialize()?{
jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
jf.setResizable(false);
jf.setLocation(602289);
jf.setSize(10?*?23?+?6?12?*?23?+?7);
JMenuBar?jmb?=?new?JMenuBar();
jf.setJMenuBar(jmb);
JMenu?start?=?new?JMenu(“開始“);
jmb.add(start);
JMenuItem?restart?=?new?JMenuItem(“重新開始“);
start.add(restart);
restart.addActionListener(new?ActionListener()?{
@Override
public?void?actionPerformed(ActionEvent?e)?{
//?TODO?Auto-generated?method?stub
jf.setSize(row?*?D?+?6?(col?+?2)?*?D?+?7);
j
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????158??2019-07-21?11:36??test\先閱讀我.txt
?????文件??????31221??2019-07-20?20:59??test\打包后文件\game.jar
?????文件????1516608??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\awt.dll
?????文件??????16960??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\bci.dll
?????文件?????159808??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\dcpr.dll
?????文件??????86080??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\decora_sse.dll
?????文件?????586816??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\deploy.dll
?????文件????1025088??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\dtplugin\deployJava1.dll
?????文件????1156160??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\dtplugin\npdeployJava1.dll
?????文件??????29760??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\dt_shmem.dll
?????文件??????24640??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\dt_socket.dll
?????文件?????136256??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\eula.dll
?????文件?????274496??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\fontmanager.dll
?????文件?????186944??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\fxplugins.dll
?????文件?????265792??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\glass.dll
?????文件?????455744??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\glib-lite.dll
?????文件?????619584??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\gstreamer-lite.dll
?????文件?????158272??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\hprof.dll
?????文件?????123456??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\instrument.dll
?????文件??????19008??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\j2pcsc.dll
?????文件??????63552??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\j2pkcs11.dll
?????文件??????21056??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\jaas_nt.dll
?????文件??????34368??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\jabswitch.exe
?????文件??????15936??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\java-rmi.exe
?????文件?????159808??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\java.dll
?????文件?????206912??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\java.exe
?????文件?????142400??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\JavaAccessBridge-64.dll
?????文件?????186368??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\javacpl.cpl
?????文件??????79936??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\javacpl.exe
?????文件??????69184??2019-06-08?20:51??test\打包后文件\jre1.8.0_131\bin\javafx_font.dll
............此處省略240個文件信息
- 上一篇:javaweb大型項目源碼——游戲交易網
- 下一篇:JAVA班級管理系統代碼
評論
共有 條評論