本文整理汇总了Java中java.awt.peer.ComponentPeer.prepareImage方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentPeer.prepareImage方法的具体用法?Java ComponentPeer.prepareImage怎么用?Java ComponentPeer.prepareImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.peer.ComponentPeer
的用法示例。
在下文中一共展示了ComponentPeer.prepareImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareImage
import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
* Prepares an image for rendering on this component at the
* specified width and height.
* <p>
* The image data is downloaded asynchronously in another thread,
* and an appropriately scaled screen representation of the image is
* generated.
* @param image the instance of <code>Image</code>
* for which to prepare a screen representation
* @param width the width of the desired screen representation
* @param height the height of the desired screen representation
* @param observer the <code>ImageObserver</code> object
* to be notified as the image is being prepared
* @return <code>true</code> if the image has already been fully
* prepared; <code>false</code> otherwise
* @see java.awt.image.ImageObserver
* @since JDK1.0
*/
public boolean prepareImage(Image image, int width, int height,
ImageObserver observer) {
ComponentPeer peer = this.peer;
if (peer instanceof LightweightPeer) {
return (parent != null)
? parent.prepareImage(image, width, height, observer)
: getToolkit().prepareImage(image, width, height, observer);
} else {
return (peer != null)
? peer.prepareImage(image, width, height, observer)
: getToolkit().prepareImage(image, width, height, observer);
}
}
示例2: prepareImage
import java.awt.peer.ComponentPeer; //导入方法依赖的package包/类
/**
* Prepares an image for rendering on this component at the
* specified width and height.
* <p>
* The image data is downloaded asynchronously in another thread,
* and an appropriately scaled screen representation of the image is
* generated.
* @param image the instance of {@code Image}
* for which to prepare a screen representation
* @param width the width of the desired screen representation
* @param height the height of the desired screen representation
* @param observer the {@code ImageObserver} object
* to be notified as the image is being prepared
* @return {@code true} if the image has already been fully
* prepared; {@code false} otherwise
* @see java.awt.image.ImageObserver
* @since 1.0
*/
public boolean prepareImage(Image image, int width, int height,
ImageObserver observer) {
ComponentPeer peer = this.peer;
if (peer instanceof LightweightPeer) {
return (parent != null)
? parent.prepareImage(image, width, height, observer)
: getToolkit().prepareImage(image, width, height, observer);
} else {
return (peer != null)
? peer.prepareImage(image, width, height, observer)
: getToolkit().prepareImage(image, width, height, observer);
}
}