freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

java拼圖游戲論文正稿(編輯修改稿)

2025-07-25 08:31 本頁(yè)面
 

【文章內(nèi)容簡(jiǎn)介】 從而實(shí)現(xiàn)動(dòng)作事件的監(jiān)聽(tīng)。l 通過(guò)對(duì)btn控件添加監(jiān)聽(tīng)事件來(lái)實(shí)現(xiàn)拼圖游戲中的控件上下移動(dòng)。3 詳細(xì)設(shè)計(jì) 核心功能代碼實(shí)現(xiàn)技術(shù)實(shí)現(xiàn)拼圖游戲窗體的顯示,代碼如下:public void init() { (拼圖游戲)。 //菜單顯示 (null)。 (400,50,300,480)。 (80,10,120,20)。 (100,50,100,20)。 ()。 (menubar)。 (isover)。 (lstep)。 (menu1)。 //添加菜單 (menu2)。 (menu3)。 (item1)。 (item2)。 (item3)。 (item4)。 (item5)。 (nandu1)。 (nandu2)。 (nandu3)。 (true)。 //設(shè)置單選菜單默認(rèn)值 (true)。 (this)。 //注冊(cè)監(jiān)聽(tīng)事件 (this)。 (this)。 (this)。 (this)。 (this)。 (this)。 setpic()。 } 程序的流程圖:游戲結(jié)束窗體顯示圖片放置動(dòng)作事件的監(jiān)聽(tīng)事件響應(yīng)是否開(kāi)始游戲拼圖完整 程序流程圖 程序運(yùn)行效果圖: 3*3的簡(jiǎn)單難度的效果圖 4*4的一般難度的效果圖,: 圖片選擇后的效果圖 正在游戲效果圖4 課程設(shè)計(jì)總結(jié)經(jīng)過(guò)這段時(shí)間的學(xué)習(xí)我收獲不小,總結(jié)起來(lái)有如下幾點(diǎn):,體會(huì)到JAVA與其他編程語(yǔ)言的不同。對(duì)于這種面向?qū)ο蟮木幊趟枷?,使剛?cè)腴T(mén)的人很快就能寫(xiě)出自己的程序。,在編程中有許多類和方法在課本中沒(méi)有學(xué)到和提及到。都是通過(guò)自己查幫助文檔,或通過(guò)網(wǎng)絡(luò)進(jìn)行學(xué)習(xí)和了解到的。和別人在一起交流是一件很快了的事。,而不是單純的寫(xiě)代碼。如何解決類之間的關(guān)聯(lián)和繼承關(guān)系,如何組織類是很關(guān)鍵的。此外對(duì)于接口和變量的私有還是公有,以及參數(shù)傳遞等方面也收獲不小。學(xué)習(xí)參考附錄源代碼import .*。import 。import 。import 。import .*。public class Games extends JFrame implements ActionListener {private JButton buttons[][]。// 存儲(chǔ)按鍵的數(shù)組private Container container。// 一個(gè)容器private GridLayout layout。// 布局方式為GridLayoutprivate int count = 0, is[] = new int[8]。// count的作用是計(jì)算按鍵移動(dòng)的次數(shù),is[]儲(chǔ)存一個(gè)隨機(jī)產(chǎn)生的1到8數(shù)字?jǐn)?shù)組public Games() { super(拼圖游戲)。// 設(shè)置標(biāo)題 layout = new GridLayout(3, 3)。// 3行3列 container = getContentPane()。// 該容器的布局方式,及其重要,否則產(chǎn)生空引用異常 (layout)。// 將該布局方式作用于容器 buttons = new JButton[3][3]。// 給按鍵數(shù)組分配儲(chǔ)存空間 int locate1, locate2。// locate1用來(lái)指示當(dāng)前產(chǎn)生的元素 locate2用來(lái)指示locate1之前的元素 for (locate1 = 0。 locate1 8。 locate1++) {// 該方法作用是產(chǎn)生1到8這8個(gè)數(shù),隨機(jī)分配給數(shù)組,即無(wú)序排列 int g = new Random().nextInt(8) + 1。// 隨機(jī)產(chǎn)生一個(gè)空白按鍵,即不顯示的那個(gè) is[locate1] = g。for (locate2 = locate1 1。 0 = locate2。 locate2) { if (is[locate1] == is[locate2]) break。 } if (locate2 != 1) locate1。 } int temp = 0。 int r = new Random().nextInt(3)。// 隨機(jī)產(chǎn)生一個(gè)0到3的數(shù),代表空白按鍵的行 int l = new Random().nextInt(3)。// 隨機(jī)產(chǎn)生一個(gè)0到3的數(shù),代表空白按鍵的列 for (int i = 0。 i 3。 i++) {for (int j = 0。 j 3。 j++) { if (r == i amp。amp。 l == j) {// 空白按鍵設(shè)置為9,不顯示 buttons[i][j] = new JButton(9)。 (buttons[i][j])。 buttons[i][j].setVisible(false)。 } else { buttons[i][j] = new JButton( + is[temp++])。// 將數(shù)組數(shù)組的值作為顯示的8個(gè)按鍵的名字 (buttons[i][j])。 } buttons[i][j].addActionListener(this)。// 注冊(cè)監(jiān)聽(tīng)事件 } } setSize(300, 300)。// 設(shè)置顯示容器區(qū)域大小 setVisible(true)。}public void actionPerformed(ActionEvent event) {// 事件處理,由于計(jì)算量小該處將所有按鍵單獨(dú)分析 JButton b = (JButton) ()。 if (b == buttons[0][0]) {if (buttons[0][1].getText().equals(9)) { buttons[0][1].setText( + buttons[0][0].getText())。 buttons[0][1].setVisible(true)。 buttons[0][0].setText(9)。 buttons[0][0].setVisible(false)。 count++。} else if (buttons[1][0].getText().equals(9)) { buttons[1][0].setText( + buttons[0][0].getText())。 buttons[1][0].setVisible(true)。 buttons[0][0].setText(9)。 buttons[0][0].setVisible(false)。 count++。} } else if (b == buttons[0][1]) {if (buttons[0][0].getText().equals(9)) { button
點(diǎn)擊復(fù)制文檔內(nèi)容
法律信息相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1