?? showimage.java
字號:
//ShowImage.java
import java.awt.*;
import java.awt.image.*;
import java.applet.Applet;
//ShowImage.java演示了在Applet中演示單個圖片
public class ShowImage extends Applet {
Image imgObj;
int process;
public void init( ){
imgObj=getImage(getCodeBase(),"picture.jpg");
}
public void paint(Graphics show){
show.drawImage(imgObj,0,0,this);
}
public boolean imageUpdate(Image img,int flags,int x,int y,int w, int h){
//ALLBITS,ERROR,SOMEBITS為ImageObserver中定義的常數標志
if( ( flags&SOMEBITS ) != 0 )
{
process += h;
int per=process*100/img.getHeight(this);
if(per<100)
showStatus("please waiting ...loading:"+per+"%");
else
showStatus("done");
repaint(x,y,w,h);
}
if((flags&ERROR)!=0)
{
System.out.print("loading error!");
}
return (flags&(ALLBITS|ERROR))==0;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -