Here you can find the source of readBufferedImage(JTextField out)
Parameter | Description |
---|---|
out | The output stream to write error messages to. |
public static BufferedImage readBufferedImage(JTextField out)
//package com.java2s; //License from project: Open Source License import javax.imageio.ImageIO; import javax.swing.JTextField; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; public class Main { /**/*ww w .j a v a2 s . c om*/ * Reads an image file from disk and returns and BufferedImage. * * @param out The output stream to write error messages to. * @return A BufferedImage object of the image file. */ public static BufferedImage readBufferedImage(JTextField out) { BufferedImage image = null; File fileLocation = new File("img/balls.gif"); try { image = ImageIO.read(fileLocation); } catch (IOException e) { out.setText(String.format("Could not open image: %s", "img/balls.gif")); } return image; } }