예제 #1
0
 public void parseAttributes(Element elm, JComponent comp) {
   String enabled = elm.getAttribute("enabled");
   if (enabled != null) {
     comp.setEnabled(!enabled.equals("false"));
   }
   String id = elm.getAttribute("id");
   if (id.length() > 0) {
     components.put(id, comp);
     comp.setName(id);
   }
   String tooltip = elm.getAttribute("tooltip");
   if (tooltip.length() > 0) {
     comp.setToolTipText(tooltip);
   }
 }
예제 #2
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));
     }
   }
 }