def compileComponent(self,game,dialog,node): c = None text = node.getAttribute("text") if node.hasAttribute("text") else "" align = int(node.getAttribute("align")) if node.hasAttribute("align") else 0 #Components if node.nodeName=="jpanel": c = JPanel.load(game,dialog,node,text,align) elif node.nodeName=="jlabel": c = JLabel.load(game,dialog,node,text,align) elif node.nodeName=="jbutton": c = JButton.load(self,game,dialog,node,text,align) elif node.nodeName=="nglcanvas": c = NGLCanvas(game,int(self.getCascadingAttribute(game,node,"width")),int(self.getCascadingAttribute(game,node,"height"))) dialog.registerCanvas(int(node.getAttribute("id")),c) #Layout if node.parentNode.getAttribute("layout")=="absolute": c.setBounds(self.getBounds(game,node)) elif node.parentNode.getAttribute("layout")=="box-y": c.setAlignmentX(Component.CENTER_ALIGNMENT); if node.hasAttribute("width") and node.hasAttribute("height"): c.setPreferredSize(Dimension(int(self.getCascadingAttribute(game,node,"width")),int(self.getCascadingAttribute(game,node,"height")))) if node.hasAttribute("minWidth") and node.hasAttribute("minHeight"): c.setMinimumSize(Dimension(int(node.getAttribute("minWidth")),int(node.getAttribute("minHeight")))) if node.hasAttribute("maxWidth") and node.hasAttribute("maxHeight"): c.setMaximumSize(Dimension(int(node.getAttribute("maxWidth")),int(node.getAttribute("maxHeight")))) elif node.parentNode.getAttribute("layout")=="box-x": c.setAlignmentY(Component.CENTER_ALIGNMENT); if node.hasAttribute("width") and node.hasAttribute("height"): c.setPreferredSize(Dimension(int(self.getCascadingAttribute(game,node,"width")),int(self.getCascadingAttribute(game,node,"height")))) if node.hasAttribute("minWidth") and node.hasAttribute("minHeight"): c.setMinimumSize(Dimension(int(node.getAttribute("minWidth")),int(node.getAttribute("minHeight")))) if node.hasAttribute("maxWidth") and node.hasAttribute("maxHeight"): c.setMaximumSize(Dimension(int(node.getAttribute("maxWidth")),int(node.getAttribute("maxHeight")))) if node.nodeName!="nglcanvas" and node.nodeName!="jpanel": self.addListeners(game,c,node) return c;