Exemplo n.º 1
0
 /**
  * Make a BufferedImage from the contents of an image file.
  *
  * @param imageFileContents byte array containing the guts of a JPG, GIF, or PNG
  */
 public BufferedImage makeBufferedImage(byte[] imageFileContents) {
   BufferedImage bi = null;
   try {
     InputStream in = new ByteArrayInputStream(imageFileContents);
     bi = javax.imageio.ImageIO.read(in);
   } catch (IOException ioe) {
     GLApp.err("GLImage.makeBufferedImage(): " + ioe);
   }
   return bi;
 }
Exemplo n.º 2
0
 private void seticon() {
   Image icon;
   try {
     InputStream data = MainFrame.class.getResourceAsStream("icon.png");
     icon = javax.imageio.ImageIO.read(data);
     data.close();
   } catch (IOException e) {
     throw (new Error(e));
   }
   setIconImage(icon);
 }
Exemplo n.º 3
0
 public static Image readImage(String filePath) throws IOException {
   return javax.imageio.ImageIO.read(new File(filePath));
 }