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


Python JLabel.setVerticalAlignment方法代码示例

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


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

示例1: __init__

# 需要导入模块: from javax.swing import JLabel [as 别名]
# 或者: from javax.swing.JLabel import setVerticalAlignment [as 别名]
 def __init__(self):
     self.setAlwaysOnTop(False);
     self.setSize(500, 500);
     menubar = JMenuBar();
     menu = JMenu("A Menu");
     menu_ac = menu.getAccessibleContext();
     menu_ac.setAccessibleDescription("The only menu in this program");
     menuitem = JMenuItem("A Menu Item");
     menu.add(menuitem);
     menubar.add(menu);
     self.setJMenuBar(menubar);
     lbl = JLabel("A Label");
     lbl.setHorizontalAlignment(JLabel.CENTER);
     lbl.setVerticalAlignment(JLabel.CENTER);
     self.setContentPane(lbl);
     self.setVisible(True);
开发者ID:dxc-test-account,项目名称:community-scripts,代码行数:18,代码来源:window_creation_template.py

示例2: AlbumArt

# 需要导入模块: from javax.swing import JLabel [as 别名]
# 或者: from javax.swing.JLabel import setVerticalAlignment [as 别名]
class AlbumArt(SongContextView):

    def __init__(self):
        # set up the layout
        self.__component = JPanel(GridBagLayout())
        self.__image = JLabel()
        self.__album = JLabel()
        self.__artist = JLabel()
        self.__application = None
        self.__image.setVerticalAlignment(SwingConstants.TOP)
        self.__album.setVerticalAlignment(SwingConstants.TOP)
        self.__artist.setVerticalAlignment(SwingConstants.TOP)
        gbc = GridBagConstraints()
        gbc.fill = GridBagConstraints.VERTICAL
        gbc.anchor = GridBagConstraints.NORTHWEST
        gbc.gridx = 0
        gbc.gridy = 0
        gbc.weighty = 2
        gbc.gridheight = 2
        self.__component.add(self.__image, gbc)
        gbc.fill = GridBagConstraints.HORIZONTAL
        gbc.anchor = GridBagConstraints.NORTHWEST
        gbc.gridx = 1
        gbc.gridy = 0
        gbc.gridheight = 1
        gbc.weighty = 0
        gbc.insets = Insets(0, 10, 0, 10)
        self.__component.add(self.__album, gbc)
        gbc.fill = GridBagConstraints.BOTH
        gbc.anchor = GridBagConstraints.NORTHWEST
        gbc.gridx = 1
        gbc.gridy = 1
        gbc.weightx = 2
        gbc.weighty = 2
        gbc.gridheight = 1
        self.__component.add(self.__artist, gbc)


    # Is called when this view should be updated.
    def update(self, song):
        # check for None!
        if (song != None):
            albumArt = song.getImage()
            if (albumArt != None):
                self.__image.setIcon(ImageIcon(ImageScaler.scale(albumArt, 300, 300)));
            else:
                self.__image.setIcon(None);

            self.__album.setText("<html><font size='+3'>" + song.getAlbum() + "</font></html>");
            self.__artist.setText("<html><font color='#555555' size='-1'>by " + song.getArtist() + "</font></html>");
        else:
            self.__image.setIcon(None);
            self.__album.setText(None);
            self.__artist.setText(None);



    # Every SongContextView needs to be accompanied by a
    # SongContextComponentShowHideAction.
    # Return the action's id here.
    def getShowHideActionId(self):
        return "jython.albumart.showhide"


    # The visual component to be shown in this view.
    def getComponent(self):
        return self.__component


    def setApplication(self, application):
        self.__application = application


    def getApplication(self):
        return self.__application


    def getId(self):
        return "jython.albumart"


    def init(self):
        pass

    def shutdown(self):
        pass
开发者ID:beatunes,项目名称:beaTlet-samples,代码行数:88,代码来源:AlbumArt.py


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