/** * Reads a property list (key and element pairs) from the input stream. The stream is assumed to * be using the ISO 8859-1 character encoding. */ public synchronized void load(InputStream is) throws IOException { BufferedReader r; r = new BufferedReader(new InputStreamReader(is, PREFERENCE_ENCODING)); DocumentFactory df = new SAXDocumentFactory( GenericDOMImplementation.getDOMImplementation(), xmlParserClassName); Document doc = df.createDocument("http://xml.apache.org/batik/preferences", "preferences", null, r); Element elt = doc.getDocumentElement(); for (Node n = elt.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() == Node.ELEMENT_NODE) { if (n.getNodeName().equals("property")) { String name = ((Element) n).getAttributeNS(null, "name"); StringBuffer cont = new StringBuffer(); for (Node c = n.getFirstChild(); c != null; c = c.getNextSibling()) { if (c.getNodeType() == Node.TEXT_NODE) { cont.append(c.getNodeValue()); } else { break; } } String val = cont.toString(); put(name, val); } } } }
public GraphicSet importSetFromFile(File inputFile, List<String> warnings) throws ImportException { Writer out = null; try { // Get a DOMImplementation DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); // Create an instance of org.w3c.dom.Document Document document = domImpl.createDocument(null, "svg", null); // Create an instance of the SVG Generator final SVGGraphics2D svgGenerator = new SVGGraphics2D(document); svgGenerator.setTransform(new AffineTransform()); // Open input file PSInputFile in = new PSInputFile(inputFile.getAbsolutePath()); Rectangle2D bb = this.getBoundingBox(inputFile); svgGenerator.setTransform(AffineTransform.getTranslateInstance(-bb.getX(), -bb.getY())); Dimension d = new Dimension((int) bb.getWidth(), (int) bb.getHeight()); // Create processor and associate to input and output file Processor processor = new Processor(svgGenerator, d, false); processor.setData(in); // Process processor.process(); File tmp = File.createTempFile("temp", "svg"); tmp.deleteOnExit(); svgGenerator.stream(new FileWriter(tmp)); GraphicSet result = new SVGImporter().importSetFromFile(tmp, warnings); // Assume the EPS has been created with 72DPI (from Inkscape) double px2mm = Util.inch2mm(1d / 72d); result.setBasicTransform(AffineTransform.getScaleInstance(px2mm, px2mm)); return result; } catch (Exception ex) { Logger.getLogger(EPSImporter.class.getName()).log(Level.SEVERE, null, ex); throw new ImportException(ex); } }
private static void exportScreenshotSVG( Component target, File selectedFile, boolean paintOffscreen) throws IOException { String format = "svg"; selectedFile = fixFileExt(selectedFile, new String[] {format}, format); // Create an instance of org.w3c.dom.Document. DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); String svgNS = "http://www.w3.org/2000/svg"; Document document = domImpl.createDocument(svgNS, format, null); // Write image data into document SVGGraphics2D svgGenerator = new SVGGraphics2D(document); choosePaint(target, svgGenerator, paintOffscreen); Writer out = null; try { // Finally, stream out SVG to the standard output using // UTF-8 encoding. boolean useCSS = true; // we want to use CSS style attributes out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(selectedFile), "UTF-8")); svgGenerator.stream(out, useCSS); } finally { if (out != null) try { out.close(); } catch (IOException e) { log.error("Error closing svg file", e); } } }
/** Builds an <code>SVGGraphics2D</code> with a default configuration. */ protected SVGGraphics2D buildSVGGraphics2D() { // CSSDocumentHandler.setParserClassName(CSS_PARSER_CLASS_NAME); DOMImplementation impl = GenericDOMImplementation.getDOMImplementation(); String namespaceURI = SVGConstants.SVG_NAMESPACE_URI; Document domFactory = impl.createDocument(namespaceURI, SVG_SVG_TAG, null); SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(domFactory); GraphicContextDefaults defaults = new GraphicContextDefaults(); defaults.font = new Font("Arial", Font.PLAIN, 12); ctx.setGraphicContextDefaults(defaults); ctx.setPrecision(12); return new SVGGraphics2D(ctx, false); }
public static void exportSVGImage(PrintWriter pr, Component c) throws IOException { // Get a DOMImplementation. DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); // Create an instance of org.w3c.dom.Document. String svgNS = "http://www.w3.org/2000/svg"; Document document = domImpl.createDocument(svgNS, "svg", null); // Create an instance of the SVG Generator. SVGGraphics2D svgGenerator = new SVGGraphics2D(document); c.paint(svgGenerator); // Finally, stream out SVG to the standard output using // UTF-8 encoding. svgGenerator.stream(pr, false); }
/** * Exports a JFreeChart to a SVG file. * * @param chart JFreeChart to export * @param bounds the dimensions of the viewport * @param svgFile the output file. * @throws IOException if writing the svgFile fails. */ public static byte[] convertChartToSVG(JFreeChart chart, int width, int height) { // Get a DOMImplementation and create an XML document DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); Document document = domImpl.createDocument(null, "svg", null); // Create an instance of the SVG Generator SVGGraphics2D svgGenerator = new SVGGraphics2D(document); // draw the chart in the SVG generator chart.draw(svgGenerator, new Rectangle(width, height)); // Write svg file try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Writer out = new OutputStreamWriter(baos, "UTF-8"); svgGenerator.stream(out, true /* use css */); out.flush(); out.close(); return baos.toByteArray(); } catch (Exception e) { throw new RuntimeException(e); } }
/** * Do request. * * @param request the request * @param response the response * @throws ServletException the servlet exception * @throws IOException Signals that an I/O exception has occurred. */ private void doRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String appId = request.getParameter("appId"); String versId = request.getParameter("versId"); // Build the rest client ClientResponse restResponse; MultivaluedMap<String, String> queryParams; String isserver = (String) getServletContext().getAttribute("isserver"); URI uri = UriBuilder.fromUri(isserver + "/rest/").build(); Client client = Client.create(); WebResource service = client.resource(uri); // Issue the request /* restResponse = service.path("application/"+appId+"/"+versId+"/deployment").accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); String deployments = restResponse.getEntity(String.class); System.out.println(deployments); */ // Issue the request restResponse = service .path("application/" + appId + "/" + versId + "/topology") .accept(MediaType.APPLICATION_JSON) .get(ClientResponse.class); String descStr = restResponse.getEntity(String.class); JSONObject temp = new JSONObject(descStr); String desc = temp.getString("versTopology"); System.out.println(desc); /* // Build report JSONObject json = new JSONObject(); json.put("desc", new JSONObject(desc)); json.put("depl", new JSONArray(deployments)); response.setContentType("application/json"); response.getWriter().write(json.toString()); */ // Get a DOMImplementation. DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); // Create an instance of org.w3c.dom.Document. String svgNS = "http://www.w3.org/2000/svg"; Document document = domImpl.createDocument(svgNS, "svg", null); // Create an instance of the SVG Generator. SVGGraphics2D svgGenerator = new SVGGraphics2D(document); // Ask the test to render into the SVG Graphics2D implementation. try { // TODO // desc is in xml ? can be done with json this.paint(svgGenerator, desc); } catch (Exception e) { e.printStackTrace(); } // Finally, stream out SVG to the standard output using // UTF-8 encoding. boolean useCSS = true; // we want to use CSS style attributes OutputStream outStream = response.getOutputStream(); // Writer out = new OutputStreamWriter(System.out, "UTF-8"); Writer out = new OutputStreamWriter(outStream, "UTF-8"); svgGenerator.stream(out, useCSS); response.setContentType("application/xml"); // response.getWriter().write(svgGenerator.toString()); // response.getWriter().write(outStream.toString()); }
/** * Draws a complex graph * * @param nonProteinGraph whether the graph is a non-protein graph and should be drawn black and * white * @param cg the complex graph * @param molInfoForChains info mapping chain IDs (like "A") to their macromolecule (MOL_ID in PDB * file, e.g., "1"). Give an empty one if you dont know * @return a draw result */ private static DrawResult drawChainLevelComplexGraphG2D( Boolean nonProteinGraph, ComplexGraph cg, Map<String, String> molInfoForChains) { Integer numVerts = cg.getVertices().size(); Boolean bw = nonProteinGraph; // All these values are in pixels // page setup PageLayout pl = new PageLayout(numVerts); Position2D vertStart = pl.getVertStart(); // ------------------------- Prepare stuff ------------------------- // TYPE_INT_ARGB specifies the image format: 8-bit RGBA packed into integer pixels // BufferedImage bi = new BufferedImage(pl.getPageWidth(), pl.getPageHeight(), // BufferedImage.TYPE_INT_ARGB); SVGGraphics2D ig2; // if(Settings.get("plcc_S_img_output_format").equals("SVG")) { // Apache Batik SVG library, using W3C DOM tree implementation // Get a DOMImplementation. DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); // Create an instance of org.w3c.dom.Document. String svgNS = "http://www.w3.org/2000/svg"; Document document = domImpl.createDocument(svgNS, "svg", null); // Create an instance of the SVG Generator. ig2 = new SVGGraphics2D(document); // ig2.getRoot(document.getDocumentElement()); // } // else { // ig2 = (SVGGraphics2D)bi.createGraphics(); // } ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // make background white ig2.setPaint(Color.WHITE); ig2.fillRect(0, 0, pl.getPageWidth(), pl.getPageHeight()); ig2.setPaint(Color.BLACK); // pl.drawAreaOutlines(ig2); // prepare font Font font = pl.getStandardFont(); ig2.setFont(font); FontMetrics fontMetrics = ig2.getFontMetrics(); // ------------------------- Draw header ------------------------- // check width of header string String proteinHeader = "The chain complex graph of PDB entry " + cg.pdbid + " [V=" + cg.getVertices().size() + ", E=" + cg.getEdges().size() + "]."; String addInfo = "(Interchain contact threshold is set to " + Main.chainComplexGraphContactThreshold + ". Neglected edges: " + cg.neglectedEdges + ")"; // Integer stringWidth = fontMetrics.stringWidth(proteinHeader); // Should be around 300px // for the text above Integer stringHeight = fontMetrics.getAscent(); String chainName; // the SSE number in the primary structure, N to C terminus String chainNumber; // the SSE number in this graph, 1..(this.size) if (Settings.getBoolean("plcc_B_graphimg_header")) { ig2.drawString(proteinHeader, pl.headerStart.x, pl.headerStart.y); // i2.drawString(addInfo, pl.headerStart.x, pl.headerStart.y + pl.textLineHeight); } // ------------------------- Draw the graph ------------------------- // Draw the edges as arcs java.awt.Shape shape; Arc2D.Double arc; ig2.setStroke(new BasicStroke(2)); // thin edges Integer edgeType, leftVert, rightVert, leftVertPosX, rightVertPosX, arcWidth, arcHeight, arcTopLeftX, arcTopLeftY, spacerX, spacerY, iChainID, jChainID; Integer labelPosX, labelPosY; String edges = cg.getEdges().toString(); for (Integer i = 0; i < cg.getVertices().size(); i++) { for (Integer j = i + 1; j < cg.getVertices().size(); j++) { String tmp = "(" + i + ", " + j + ")"; // If there is a contact... if (edges.indexOf(tmp) != -1) { Integer cInteractions = cg.numChainInteractions[i][j]; // determine edge type and the resulting color // edgeType = cg.getContactType(i, j); ig2.setPaint(Color.RED); if (bw) { ig2.setPaint(Color.LIGHT_GRAY); } // for non-protein graphs // ----- complex graph specific stuff ----- // determine chain of SSEs iChainID = -1; jChainID = -1; /* for(Integer x = 0; x < cg.chainEnd.size(); x++){ if(i < cg.chainEnd.get(x)) {iChainID = x; break;} } for(Integer x = 0; x < cg.chainEnd.size(); x++){ if(j < cg.chainEnd.get(x)) {jChainID = x; break;} } if (!Objects.equals(iChainID, jChainID)) {ig2.setPaint(Color.PINK);} */ // ----- end complex graph specific stuff ----- // determine the center of the arc and the width of its rectangle bounding box if (i < j) { leftVert = i; rightVert = j; } else { leftVert = j; rightVert = i; } leftVertPosX = pl.getVertStart().x + (leftVert * pl.vertDist); rightVertPosX = pl.getVertStart().x + (rightVert * pl.vertDist); arcWidth = rightVertPosX - leftVertPosX; arcHeight = arcWidth / 2; arcTopLeftX = leftVertPosX; arcTopLeftY = pl.getVertStart().y - arcHeight / 2; spacerX = pl.vertRadius; spacerY = 0; // draw it arc = new Arc2D.Double( arcTopLeftX + spacerX, arcTopLeftY + spacerY, arcWidth, arcHeight, 0, 180, Arc2D.OPEN); shape = ig2.getStroke().createStrokedShape(arc); ig2.fill(shape); } } } // draw arc labels on top to prevent unreadability for (Integer i = 0; i < cg.getVertices().size(); i++) { for (Integer j = i + 1; j < cg.getVertices().size(); j++) { String tmp = "(" + i + ", " + j + ")"; // If there is a contact... if (edges.indexOf(tmp) != -1) { iChainID = -1; jChainID = -1; if (i < j) { leftVert = i; rightVert = j; } else { leftVert = j; rightVert = i; } // TODO: is it clever to calculate everything again? leftVertPosX = pl.getVertStart().x + (leftVert * pl.vertDist); rightVertPosX = pl.getVertStart().x + (rightVert * pl.vertDist); arcWidth = rightVertPosX - leftVertPosX; arcHeight = arcWidth / 2; arcTopLeftX = leftVertPosX; arcTopLeftY = pl.getVertStart().y - arcHeight / 2; spacerX = pl.vertRadius; spacerY = 0; // calculate label positions labelPosX = leftVertPosX + arcWidth / 2 + 2; labelPosY = arcTopLeftY + spacerY - 5; // draw labels on arcs Font labelfont = new Font( Settings.get("plcc_S_img_default_font"), Font.PLAIN, Settings.getInteger("plcc_I_img_default_font_size") - 5); ig2.setFont(labelfont); ig2.setPaint(Color.BLACK); Integer cInteractions = cg.numChainInteractions[i][j]; if (cInteractions != null) { ig2.drawString(cInteractions.toString(), labelPosX, labelPosY + (stringHeight / 4)); } } } } ig2.setFont(font); // Draw the vertices as circles Ellipse2D.Double circle; Rectangle2D.Double rect; ig2.setStroke(new BasicStroke(2)); boolean colorSet = false; cg.savedVertexColors = new float[cg.getVertices().size()]; for (Integer i = 0; i < cg.getVertices().size(); i++) { // set standard color ig2.setPaint(Color.GRAY); if (bw) { ig2.setPaint(Color.GRAY); } // for non-protein graphs // set hue, saturation, brighness float h = (float) 0.5; float s = (float) 1.0; // change this for saturation (higher = more saturated) float b = (float) 0.8; // change this for brightness (0.0 -> Dark/Black) for (Integer j = 0; j < cg.getVertices().size(); j++) { // if chain has an homologue partner... if (cg.homologueChains[i][j] != null) { if (cg.homologueChains[i][j] == 1) { // if homologue partner wasn't colored before.. if (cg.savedVertexColors[i] == 0) { h = cg.getUniqueColor(numVerts); // get unique color for (int y = j; y < cg.homologueChains.length; y++) { if (cg.homologueChains[i][y] == 1) { cg.savedVertexColors[i] = h; cg.savedVertexColors[y] = h; } } colorSet = true; } else { h = cg.savedVertexColors[i]; } ig2.setPaint(Color.getHSBColor(h, s, b)); colorSet = true; } } } // if no homologue chains occur if (!colorSet) { h = cg.getUniqueColor(numVerts); // get unique color cg.savedVertexColors[i] = h; ig2.setPaint(Color.getHSBColor(h, s, b)); } colorSet = false; // pick color depending on SSE type // draw a shape based on SSE type rect = new Rectangle2D.Double( vertStart.x + (i * pl.vertDist), vertStart.y, pl.getVertDiameter(), pl.getVertDiameter()); ig2.fill(rect); } // Draw the markers for the N-terminus and C-terminus if there are any vertices in this graph ig2.setStroke(new BasicStroke(2)); ig2.setPaint(Color.BLACK); /* if( ! bw) { if(cg.getVertices().size() > 0) { ig2.drawString("N", vertStart.x - pl.vertDist, vertStart.y + 20); // N terminus label ig2.drawString("C", vertStart.x + cg.getVertices().size() * pl.vertDist, vertStart.y + 20); // C terminus label } } */ // ************************************* footer ************************************** if (Settings.getBoolean("plcc_B_graphimg_footer")) { // Draw the vertex numbering into the footer // Determine the dist between vertices that will have their vertex number printed below them // in the footer field Integer printNth = 1; if (cg.getVertices().size() > 9) { printNth = 1; } if (cg.getVertices().size() > 99) { printNth = 2; } // line markers: S for sequence order, G for graph order Integer lineHeight = pl.textLineHeight; if (cg.getVertices().size() > 0) { ig2.drawString( "C#", pl.getFooterStart().x - pl.vertDist, pl.getFooterStart().y + (stringHeight / 4)); ig2.drawString( "CN", pl.getFooterStart().x - pl.vertDist, pl.getFooterStart().y + lineHeight + (stringHeight / 4)); ig2.drawString( "ML", pl.getFooterStart().x - pl.vertDist, pl.getFooterStart().y + (lineHeight * 2) + (stringHeight / 4)); } else { ig2.drawString("(Graph has no vertices.)", pl.getFooterStart().x, pl.getFooterStart().y); } iChainID = -1; String edgesString = cg.proteinNodeMap.toString(); // System.out.println("DrawChainLevelCG: edgesString is '" + edgesString + "'."); for (Integer i = 0; i < cg.getVertices().size(); i++) { // Draw label for every nth vertex if ((i + 1) % printNth == 0) { chainNumber = "" + (i + 1); // sseNumberSeq = "" + (cg.proteinNodeMap.get(i)); Integer foundIndex = edgesString.indexOf(i.toString() + "="); String chainId; if (i < 10) { chainId = edgesString.substring(foundIndex + 2, foundIndex + 3); } else { chainId = edgesString.substring(foundIndex + 3, foundIndex + 4); } chainName = "" + chainId; // stringWidth = fontMetrics.stringWidth(sseNumberSeq); stringHeight = fontMetrics.getAscent(); ig2.drawString( chainNumber, pl.getFooterStart().x + (i * pl.vertDist) + pl.vertRadius / 2, pl.getFooterStart().y + (stringHeight / 4)); ig2.drawString( chainName, pl.getFooterStart().x + (i * pl.vertDist) + pl.vertRadius / 2, pl.getFooterStart().y + (lineHeight * 1) + (stringHeight / 4)); ig2.drawString( molInfoForChains.get(chainName), pl.getFooterStart().x + (i * pl.vertDist) + pl.vertRadius / 2, pl.getFooterStart().y + (lineHeight * 2) + (stringHeight / 4)); // determine chain of SSEs /*for(Integer x = 0; x < cg.getVertices().size(); x++){ if(i < cg.chainEnd.get(x)) {iChainID = x; break;} } */ // if(iChainID != -1) {ig2.drawString(cg.allChains.get(iChainID).getPdbChainID(), // pl.getFooterStart().x + (i * pl.vertDist) + pl.vertRadius / 2, pl.getFooterStart().y + // (lineHeight * 2) + (stringHeight / 4));} } } /* if(Settings.getBoolean("plcc_B_graphimg_legend")) { if(iChainID != -1){ SSEGraph.drawLegend(ig2, new Position2D(pl.getFooterStart().x, pl.getFooterStart().y + lineHeight * 3 + (stringHeight / 4)), pl, pg); } else{ SSEGraph.drawLegend(ig2, new Position2D(pl.getFooterStart().x, pl.getFooterStart().y + lineHeight * 2 + (stringHeight / 4)), pl, pg); } } */ } // all done, write the image to disk // if(Settings.get("plcc_S_img_output_format").equals("SVG")) { // boolean useCSS = true; // FileOutputStream fos = new FileOutputStream(new File("/tmp/mySVG.svg")); // Writer out = new OutputStreamWriter(fos, "UTF-8"); // ig2.stream(out, useCSS); Rectangle2D roi = new Rectangle2D.Double(0, 0, pl.getPageWidth(), pl.getPageHeight()); DrawResult drawRes = new DrawResult(ig2, roi); return drawRes; }
public static void main(String[] args) throws IOException { Context context; S57map map = null; BufferedReader in; int line = 0; String format = ""; String file = ""; String k = ""; String v = ""; BufferedImage img; Graphics2D g2; boolean inIcons = false; boolean inIcon = false; if (args.length < 2) { System.err.println("Usage: java -jar jicons.jar icon_definition_file icons_directory"); System.exit(-1); } in = new BufferedReader(new FileReader(args[0])); context = new Context(); String ln; while ((ln = in.readLine()) != null) { line++; if (inIcons) { if (inIcon) { if (ln.contains("</icon")) { inIcon = false; map.tagsDone(0); // generate icon file switch (format) { case "PNG": img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); g2 = img.createGraphics(); Renderer.reRender( g2, new Rectangle(x, y, w, h), 16, s / Renderer.symbolScale[16], map, context); try { ImageIO.write(img, "png", new File(args[1] + file + ".png")); } catch (Exception e) { System.err.println("Line " + line + ": PNG write Exception"); } System.err.println(file + ".png"); break; case "SVG": DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); String svgNS = "http://www.w3.org/2000/svg"; Document document = domImpl.createDocument(svgNS, "svg", null); SVGGraphics2D svgGenerator = new SVGGraphics2D(document); svgGenerator.setSVGCanvasSize(new Dimension(w, h)); Renderer.reRender( svgGenerator, new Rectangle(x, y, w, h), 16, s / Renderer.symbolScale[16], map, context); boolean useCSS = true; Writer out = null; try { out = new OutputStreamWriter( new FileOutputStream(args[1] + file + ".svg"), "UTF-8"); } catch (IOException e1) { System.err.println("Line " + line + ": SVG file Exception"); } try { svgGenerator.stream(out, useCSS); } catch (SVGGraphics2DIOException e) { System.err.println("Line " + line + ": SVG write Exception"); } System.err.println(file + ".svg"); break; } } else if (ln.contains("<tag")) { k = v = ""; String[] token = ln.split("k="); k = token[1].split("[\"\']")[1]; token = token[1].split("v="); v = token[1].split("[\"\']")[1]; if (k.isEmpty()) { System.err.println("Line " + line + ": No key in tag"); System.exit(-1); } if (v.isEmpty()) { System.err.println("Line " + line + ": No value in tag"); System.exit(-1); } map.addTag(k, v); } } else if (ln.contains("<icon")) { inIcon = true; h = w = x = y = -1; s = 0; file = format = ""; map = new S57map(true); map.addNode(0, 0, 0); for (String token : ln.split("[ ]+")) { if (token.matches("^width=.+")) { w = Integer.parseInt(token.split("[\"\']")[1]); } else if (token.matches("^height=.+")) { h = Integer.parseInt(token.split("[\"\']")[1]); } else if (token.matches("^x=.+")) { x = Integer.parseInt(token.split("[\"\']")[1]); } else if (token.matches("^y=.+")) { y = Integer.parseInt(token.split("[\"\']")[1]); } else if (token.matches("^scale=.+")) { s = Double.parseDouble(token.split("[\"\']")[1]); } else if (token.matches("^file=.+")) { file = (token.split("[\"\']")[1]); } else if (token.matches("^format=.+")) { format = (token.split("[\"\']")[1]); } } if (file.isEmpty()) { System.err.println("Line " + line + ": No filename"); System.exit(-1); } if (format.isEmpty()) { System.err.println("Line " + line + ": No format"); System.exit(-1); } if ((h < 0) && (w < 0)) { System.err.println("Line " + line + ": No icon size"); System.exit(-1); } if (w < 0) { w = h; } if (h < 0) { h = w; } if (x < 0) { x = w / 2; } if (y < 0) { y = h / 2; } if (s == 0) { s = 1; } } else if (ln.contains("</icons")) { inIcons = false; break; } } else if (ln.contains("<icons")) { inIcons = true; } } in.close(); System.err.println("Finished"); System.exit(0); }