Java BufferedImage Load loadImage(String fileName, Component c)

Here you can find the source of loadImage(String fileName, Component c)

Description

return an Image loaded by a MediaTracker.

License

Open Source License

Parameter

Parameter Description
fileName The filename.

Declaration

public final static Image loadImage(String fileName, Component c) throws InterruptedException 

Method Source Code


//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;
    }
}

Related

  1. loadImage(InputStream inputStream)
  2. loadImage(Object whoOrders, String name)
  3. loadImage(String classRelativeFile)
  4. loadImage(String filename)
  5. loadImage(String fileName)
  6. loadImage(String fileName, Component component)
  7. loadImage(String filePath)
  8. loadImage(String i, int x, int imageWidth, int imageHeight)
  9. loadImage(String image)