Java实现图像全屏显示(二)

2014-11-24 10:53:29 · 作者: · 浏览: 4
mage != null) // if screenImage is not null (image loaded and ready)


{


g.drawImage(screenImage, // draw it


w/2 - screenImage.getWidth(this) / 2, // at the center


h/2 - screenImage.getHeight(this) / 2, // of screen


this);


// to draw image at the center of screen


// we calculate X position as a half of screen width minus half of image width


// Y position as a half of screen height minus half of image height


}


}


}


注意:


如果图像未成功装载,本程序就没有输出。