本文整理汇总了Java中sun.awt.image.FileImageSource类的典型用法代码示例。如果您正苦于以下问题:Java FileImageSource类的具体用法?Java FileImageSource怎么用?Java FileImageSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileImageSource类属于sun.awt.image包,在下文中一共展示了FileImageSource类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createImage
import sun.awt.image.FileImageSource; //导入依赖的package包/类
public Image createImage(String filename) {
if (BDJXletContext.getCurrentContext() == null) {
logger.error("createImage(): no context " + Logger.dumpStack());
}
if (!new File(filename).isAbsolute()) {
String home = BDJXletContext.getCurrentXletHome();
if (home != null) {
String homeFile = home + filename;
if (new File(homeFile).exists()) {
logger.warning("resource translated to " + homeFile);
filename = homeFile;
} else {
logger.error("resource " + homeFile + " does not exist");
}
}
}
ImageProducer ip = new FileImageSource(filename);
Image newImage = createImage(ip);
return newImage;
}
示例2: getImageFromHash
import sun.awt.image.FileImageSource; //导入依赖的package包/类
static Image getImageFromHash(Toolkit tk,
String filename) {
checkPermissions(filename);
synchronized (fileImgCache) {
Image img = (Image)fileImgCache.get(filename);
if (img == null) {
try {
img = tk.createImage(new FileImageSource(filename));
fileImgCache.put(filename, img);
} catch (Exception e) {
}
}
return img;
}
}
示例3: createImage
import sun.awt.image.FileImageSource; //导入依赖的package包/类
@Override
public Image createImage(String filename) {
checkPermissions(filename);
return createImage(new FileImageSource(filename));
}
示例4: HBackgroundImage
import sun.awt.image.FileImageSource; //导入依赖的package包/类
public HBackgroundImage(String filename) {
producer = new FileImageSource(filename);
img = Toolkit.getDefaultToolkit().createImage(producer);
}