以下は上記のアプレット(demo.class)のソースです。参考になりますか??
import java.awt.*;
import java.awt.image.*;
import java.applet.*;
public class demo extends Applet {
Bitmap bmp;
int pix[]; //イメージ配列
int w; //横幅
int h; //縦幅
public void init(){
bmp = new Bitmap(getDocumentBase(),"yumeno.bmp"); //Bitmapオブジェクトを作成
pix = bmp.getBMPSource();//イメージ配列を取得
w = bmp.getWidth(); //横幅を取得
h = bmp.getHeight(); //縦幅を取得
}
public void paint(Graphics g) {
MemoryImageSource mimg = new MemoryImageSource(w,h,pix,0,w);
Image img = createImage(mimg); //イメージを生成
MediaTracker mt = new MediaTracker(this);
mt.addImage(img,0);
try{
mt.waitForAll();
} catch(InterruptedException e){ }
g.drawImage(img,0,0,this); //イメージを表示
g.drawString(" w = " + w + " pix",5,120); //縦幅を表示
g.drawString(" h = " + h + " pix",5,135); //横幅を表示
}
}