?? game.java
字號:
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import javax.swing.*;
public class Game extends Applet {
private int xpos=100,ypos=0;
private SquareShape currShape;
private Image buffer;//畫布對象
private Graphics bg;
//private Image image;
public void init() {
buffer=this.createImage(200,400);//創(chuàng)建畫布大小
bg=buffer.getGraphics();
bg.fillRect(0,0,200,400);
currShape=new Ding();
currShape.setPlace(xpos,ypos);
//image=new ImageIcon("01.jpg").getImage();
}
public void paint(Graphics g) {//圖畫由兩部分組成,一部分為背景,另一部分為圖形
g.drawImage(buffer,0,0,null);//背景
//g.drawImage(image,0,0);
currShape.drawShape(g);//圖形
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -