当前位置: 首页>>代码示例>>Python>>正文


Python JLabel.setAlignmentY方法代码示例

本文整理汇总了Python中javax.swing.JLabel.setAlignmentY方法的典型用法代码示例。如果您正苦于以下问题:Python JLabel.setAlignmentY方法的具体用法?Python JLabel.setAlignmentY怎么用?Python JLabel.setAlignmentY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JLabel的用法示例。


在下文中一共展示了JLabel.setAlignmentY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: reloadComponent

# 需要导入模块: from javax.swing import JLabel [as 别名]
# 或者: from javax.swing.JLabel import setAlignmentY [as 别名]
def reloadComponent(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":
       reloadJPanel(game,dialog,node)
    elif node.nodeName=="jlabel":
        c = JLabel(text,align)
    elif node.nodeName=="settingspanel":
        c = SettingsPanel(game)
        for g in node.childNodes:
            if g.nodeName=="group":
                c.addGroup(int(g.getAttribute("id")),g.getAttribute("label"))
                for h in g.childNodes:
                    if h.nodeName=="heading":
                        c.addHeading(int(g.getAttribute("id")),h.getAttribute("label"))
                        for s in h.childNodes:
                            if s.nodeName=="setting":
                                #<setting id="1" name="DISPLAY_REAL_WORLD_TIME" type="checkbox" label="Show Real-World Time"></setting>
                                if s.getAttribute("items")!="":
                                    c.addSettingWithItems(int(g.getAttribute("id")),int(s.getAttribute("id")),s.getAttribute("label"),s.getAttribute("type"),s.getAttribute("items").split(","))
                                else:
                                    c.addSetting(int(g.getAttribute("id")),int(s.getAttribute("id")),s.getAttribute("label"),s.getAttribute("type"))
                                

        c.finalizeSettingsPanel()
        dialog.registerSettingsPanel(int(node.getAttribute("id")),c)
    
    elif node.nodeName=="logspanel":
        c = LogsPanel(game)
        for g in node.childNodes:
            if g.nodeName=="group":
                c.addLog(int(g.getAttribute("id")),g.getAttribute("label"))                          

        c.finalizeLogsPanel()
        dialog.registerLogsPanel(int(node.getAttribute("id")),c)
        
        
    elif node.nodeName=="jbutton":
        reloadJButton(game,dialog,node,text,align)
        
    elif node.nodeName=="nglcanvas":
        c = NGLCanvas(game,int(getCascadingAttribute(game,node,"width")),int(getCascadingAttribute(game,node,"height")))
        dialog.registerCanvas(int(node.getAttribute("id")),c)
    
    #Layout
    if node.parentNode.getAttribute("layout")=="absolute":
        c.setBounds(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(getCascadingAttribute(game,node,"width")),int(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(getCascadingAttribute(game,node,"width")),int(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" and node.nodeName!="settingspanel": addListeners(game,c,node)
    return c;
开发者ID:pjdufour,项目名称:felspar,代码行数:71,代码来源:loader.py


注:本文中的javax.swing.JLabel.setAlignmentY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。