📄 utility.java
字号:
package isoj2me;import java.io.InputStream;import java.io.InputStreamReader;import java.util.Hashtable;import javax.microedition.lcdui.Image;/** * <p>Title: isoj2me: J2ME Isometric Engine</p> * <p>Description: An engine/framework for isometric games (like japanese RPGs) for mobile devices supporting J2ME (MIDP 1.0). This engine will manage maps, objects and characters. Visit http://sourceforge.net/projects/isoj2me</p> * <p>Copyright: Copyright (c) 2004</p> * <p>License: Lesser GPL (http://www.gnu.org)</p> * <p>Company: Mondonerd.com</p> * @author Massimo Maria Avvisati * @version 0.2 */public class Utility { public Utility() { } /** * This method return an Image loading it from the "hard disk" of the mobile phone (from the standard directory) or, if the image was already loaded, it return an image took from an hashtable * @param tile the number that identify the tile * @param tiles Hashtable where to store Images * @return the tile Image */ public static Image loadTile(int tile, Hashtable tiles) { if (tiles.containsKey(tile + "")) { return (Image) tiles.get(tile + ""); } else { try { Image temp_image = Image.createImage("/" + tile + ".png"); tiles.put(tile + "", temp_image); return (Image) tiles.get(tile + ""); } catch (Exception ex) { System.out.println("loadTile Error can't load " + tile + ":" + ex); } } return null; } /** * This method return an Image loading it from the "hard disk" of the mobile phone (from the standard directory) or, if the image was already loaded, it return an image took from an hashtable * @param tile the string that identify the tile (<b>/<i>tile</i>.png</b>) * @param tiles Hashtable where to store Images * @return the tile Image */ public static Image loadTile(String tile, Hashtable tiles) { if (tiles.containsKey(tile)) { return (Image) tiles.get(tile); } else { try { Image temp_image = Image.createImage("/" + tile + ".png"); tiles.put(tile, temp_image); return (Image) tiles.get(tile); } catch (Exception ex) { System.out.println("loadTile Error can't load " + tile + ":" + ex); } } return null; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -