private Area loadScreenArea(String pngFile) throws Exception { Area area = null; String xmlArea = "./workspace/" + file.substring(0, file.indexOf("/")) + "/screen_area.xml"; System.out.println(xmlArea); XmlUtil xmlUtil = new XmlUtil(xmlArea); Document doc = xmlUtil.parse(xmlArea); Element root = doc.getDocumentElement(); NodeList childs = root.getChildNodes(); if (childs != null) { for (int i = 0; i < childs.getLength(); i++) { Node node = childs.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap map = node.getAttributes(); String fileName = map.getNamedItem("file").getNodeValue(); if (fileName.equals(pngFile)) { area = new Area(); area.setFile(fileName); area.setX(Integer.parseInt(map.getNamedItem("x").getNodeValue())); area.setY(Integer.parseInt(map.getNamedItem("y").getNodeValue())); area.setWidth(Integer.parseInt(map.getNamedItem("width").getNodeValue())); area.setHeight(Integer.parseInt(map.getNamedItem("height").getNodeValue())); } } } } return area; }