📄 usetexture.java
字号:
// 程序:使用纹理贴图
// 范例文件: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);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -