Here you can find the source of loadImage(String fileName, Component c)
Parameter | Description |
---|---|
fileName | The filename. |
public final static Image loadImage(String fileName, Component c) throws InterruptedException
//package com.java2s; /*/*from ww w .jav a 2s . c o m*/ * Copyright (c) Leuville Objects All Rights Reserved. * * Leuville Objects MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Leuville Objects SHALL NOT BE LIABLE FOR * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ import java.awt.*; public class Main { /** * return an Image loaded by a MediaTracker. * The caller is locked until all requests are performed. * @param fileName The filename. * @exception InterruptedException. */ public final static Image loadImage(String fileName, Component c) throws InterruptedException { MediaTracker tracker = new MediaTracker(c); Toolkit toolkit = c.getToolkit(); Image image = toolkit.getImage(fileName); tracker.addImage(image, 0); tracker.waitForAll(); return image; } }