diff --git a/src/com/msb/PropertyMgr.java b/src/com/msb/PropertyMgr.java index 0570e0f..50e5351 100644 --- a/src/com/msb/PropertyMgr.java +++ b/src/com/msb/PropertyMgr.java @@ -26,6 +26,10 @@ public class PropertyMgr { return props.get(key); } + public static String getString(String key) { + return (String) get(key); + } + public static void main(String[] args) { System.out.println(get("initTankCount")); } diff --git a/src/com/msb/TankDemo.java b/src/com/msb/TankDemo.java index e657abc..b9e0274 100644 --- a/src/com/msb/TankDemo.java +++ b/src/com/msb/TankDemo.java @@ -14,7 +14,7 @@ public class TankDemo { TankFrame tankFrame = new TankFrame(); Random random = new Random(); - int initTankCount = Integer.parseInt((String) PropertyMgr.get("initTankCount")); + int initTankCount = Integer.parseInt(PropertyMgr.getString("initTankCount")); //创建5个敌方坦克 for (int i=0; i