亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

能幫我把后面 怎么讓 畫出的方塊下落代碼補充寫出來嗎?謝謝了

能幫我把后面 怎么讓 畫出的方塊下落代碼補充寫出來嗎?謝謝了

此生不變丶 2016-06-15 15:38:29
package?zuoye20160615; import?java.awt.Color; import?java.awt.Graphics; import?javax.swing.JFrame; import?javax.swing.JPanel; /**?*?@author??作者?E-mail:? @date?創建時間:2016年6月15日?下午2:40:27? ?*/ public?class?TuXing?extends?JFrame{ MyPanel?mp; public?static?void?main(String[]?args){ TuXing?jf?=?new?TuXing();//?調用TuXing?的構造函數 } public?TuXing(){ mp?=?new?MyPanel();//?調用?JPanel?的?paintComponent的方法 this.add(mp);//把Panel放到JFrame中 this.setTitle("方塊下落");//邊框名字 this.setSize(500,500);//邊框大小 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//關閉按鈕 this.setVisible(true);//界面可視 } } class?MyPanel?extends?JPanel{ protected?void?paintComponent(Graphics?g){ g.setColor(Color.black);//填充顏色 g.fillRect(20,?50,?100,?100);//畫出一個矩形 } }
查看完整描述

2 回答

  • 2 回答
  • 1 關注
  • 1918 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號