次のコードを使用すると:
public void paint(Graphics g){
//Displays version number and name.
g.setFont(new Font("Courier", Font.PLAIN, 10));
g.drawString("DCoder " + execute.Execute.version, 2, 10);
//Displays logo in center.
g.drawImage(logo, centerAlign(logo.getWidth(null)), 50, this);
}
private int width(){
//Gets and returns width of applet.
int width = getSize().width;
return width;
}
private int height(){
//Gets and returns height of applet.
int height = getSize().height;
return height;
}
private int centerAlign(int obWidth){
int align = (width()-obWidth)/2;
return align;
}
Java アプレットでは、(アプレット ビューアー ウィンドウのサイズを変更して) repaint() を呼び出すまで、画像は表示されませんか? 画像が表示されないのはなぜですか?