Пример #1
0
 public void parseBorder(JComponent c, Element elm) {
   if (elm.getTagName().equals("border")) {
     String type = elm.getAttribute("type");
     if (type.equals("empty")) {
       c.setBorder(new EmptyBorder(2, 2, 2, 2));
     } else if (type.equals("titled")) {
       String title = elm.getAttribute("title");
       c.setBorder(new TitledBorder(title));
     } else if (type.equals("beveled")) {
       int btype = Integer.parseInt(elm.getAttribute("bevel"));
       c.setBorder(new BevelBorder(btype));
     }
   } else {
     NodeList nl = elm.getElementsByTagName("border");
     for (int n = 0; n < nl.getLength(); n++) {
       parseBorder(c, (Element) nl.item(n));
     }
   }
 }
Пример #2
0
 public SpazPosition parseSpazPosition(Element elm) {
   if (elm.getTagName().equals("position")) {
     SpazPosition lp = new SpazPosition();
     double left_rel = Double.parseDouble(elm.getAttribute("left_rel"));
     double right_rel = Double.parseDouble(elm.getAttribute("right_rel"));
     double top_rel = Double.parseDouble(elm.getAttribute("top_rel"));
     double bottom_rel = Double.parseDouble(elm.getAttribute("bottom_rel"));
     int left_abs = Integer.parseInt(elm.getAttribute("left_abs"));
     int right_abs = Integer.parseInt(elm.getAttribute("right_abs"));
     int top_abs = Integer.parseInt(elm.getAttribute("top_abs"));
     int bottom_abs = Integer.parseInt(elm.getAttribute("bottom_abs"));
     lp.setHPos(left_rel, left_abs, right_rel, right_abs);
     lp.setVPos(top_rel, top_abs, bottom_rel, bottom_abs);
     return lp;
   } else {
     NodeList nl = elm.getElementsByTagName("position");
     for (int n = 0; n < nl.getLength(); n++) {
       SpazPosition lp = parseSpazPosition((Element) (nl.item(n)));
       return lp;
     }
   }
   return null;
 }