All pastes #937487 Raw Edit

Anonymous

public java v1 · immutable
·published 2008-03-11 00:43 UTC
rendered paste body
package gridchallenge;import java.awt.image.BufferedImage;import javax.imageio.ImageIO;import java.io.File;public class Tile{  private static String[] tileObjects = new String[]  {    // lots of strings...  };  public static String getNameForTile(int tile)  {    if (tile > 0x6f || tile < 0) return null;    return tileObjects[tile];  }  public static BufferedImage getImageForTile(int tile)  {    BufferedImage res = null;    String path = "/home/konrad/src/java/gridch/GridWorldCode/projects/gridchallenge/images/" +      getNameForTile(tile) + ".png";    try    {      res = ImageIO.read(new File(path));    }    catch (Exception x)    {      //System.out.println(x.getClass().getName() + ": " + x.getMessage());      System.out.println("Need: " + getNameForTile(tile));    }    return res;  }}