?? usetexture.java
字號(hào):
// 程序:使用紋理貼圖
// 范例文件:UseTexture.java
import java.awt.*;
import java.applet.*;
public class UseTexture extends Applet
{
int ImageWidth,ImageHeight,countX,countY;
Image texture;
MediaTracker MT;
public void init()
{
countX = 5;
countY = 5;
texture = getImage(getDocumentBase(),"Images/texture.gif");
MT = new MediaTracker(this);
MT.addImage(texture,0);
try
{
MT.waitForAll();
}
catch(InterruptedException E){ }
ImageWidth = texture.getWidth(this);
ImageHeight = texture.getHeight(this);
resize(ImageWidth*countX,ImageHeight*countY);
}
public void paint(Graphics g)
{
for(int i=0;i<(countX * countY);i++)
{
g.drawImage(texture,i%countX*ImageWidth,i/countY*ImageHeight,
this);
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -