⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imageloader.java

📁 WebHangman a game can be play on the website contain the total code of JAVA
💻 JAVA
字号:
package com.aztsoft.games.util;

import java.awt.*;
import java.applet.Applet;
import java.io.IOException;

/**
 * Utilitty class to load images
 */
public class ImageLoader {
    static boolean runAsApplication = false;

    /**
     * Utility method to return an image by name
     *
     */
    public static Image loadImage(String relName, Applet thisApplet) throws IOException {
        if (runAsApplication) {
            MediaTracker tracker = new MediaTracker(thisApplet);
            Image imtexture = Toolkit.getDefaultToolkit().getImage(relName);
            tracker.addImage(imtexture, 0);
            try {
                tracker.waitForID(0);
                int width = imtexture.getWidth(thisApplet);
                int height = imtexture.getHeight(thisApplet);
            }
            catch (InterruptedException e) {
                GameLogger.log("Interrupted Exception on Image-Texture Loading", e);
            }
            return imtexture;
        } else {
            return (thisApplet.getImage(thisApplet.getCodeBase(), relName));
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -