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


Python JLabel.UI方法代码示例

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


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

示例1: __init__

# 需要导入模块: from javax.swing import JLabel [as 别名]
# 或者: from javax.swing.JLabel import UI [as 别名]
    def __init__(self):

        # Setup controls - buttons first
        self.playButton.preferredSize = self.refreshButton.preferredSize
        self.playButton.actionCommand = self.PLAY
        self.playButton.actionPerformed = self.whenButtonClicked
        self.pauseButton.preferredSize = self.refreshButton.preferredSize
        self.pauseButton.actionCommand = self.PAUSE
        self.pauseButton.actionPerformed = self.whenButtonClicked
        self.stopButton.preferredSize = self.refreshButton.preferredSize
        self.stopButton.actionCommand = self.STOP
        self.stopButton.actionPerformed = self.whenButtonClicked
        self.refreshButton.actionCommand = self.REFRESH
        self.refreshButton.actionPerformed = self.whenButtonClicked

        # Now combobox and text field
        self.sourceCombo.itemStateChanged = self.whenSourceChanged
        self.updateSourcesList()
        self.rangeSpinner.stateChanged = self.whenRangeChanged

        # Now sliders
        ticksMajor = int(self.posMinMax/4)
        ticksMinor = int(ticksMajor/5)
        labels = Hashtable(3)
        labels.put(-self.posMinMax, JLabel("Left"))
        labels.put(              0, JLabel("Centre"))
        labels.put( self.posMinMax, JLabel("Right"))
        self.positionXSlider.labelTable = labels
        self.positionXSlider.minimum = -self.posMinMax
        self.positionXSlider.maximum = self.posMinMax
        self.positionXSlider.majorTickSpacing = ticksMajor
        self.positionXSlider.minorTickSpacing = ticksMinor
        self.positionXSlider.paintTicks = True
        self.positionXSlider.paintLabels = True
        self.positionXSlider.snapToTicks = True
        self.positionXSlider.value = 0
        self.positionXSlider.stateChanged = self.whenSliderXChanged
        labels = Hashtable(3)
        labels.put(-self.posMinMax, JLabel("Behind"))
        labels.put(              0, JLabel("Centre"))
        labels.put( self.posMinMax, JLabel("In-front"))
        self.positionYSlider.labelTable = labels
        self.positionYSlider.minimum = -self.posMinMax
        self.positionYSlider.maximum = self.posMinMax
        self.positionYSlider.majorTickSpacing = ticksMajor
        self.positionYSlider.minorTickSpacing = ticksMinor
        self.positionYSlider.paintTicks = True
        self.positionYSlider.paintLabels = True
        self.positionYSlider.snapToTicks = True
        self.positionYSlider.value = 0
        self.positionYSlider.orientation = JSlider.VERTICAL
        self.positionYSlider.stateChanged = self.whenSliderYChanged
        labels = Hashtable(3)
        labels.put(-self.posMinMax, JLabel("Below"))
        labels.put(              0, JLabel("Centre"))
        labels.put( self.posMinMax, JLabel("Above"))
        self.positionZSlider.labelTable = labels
        self.positionZSlider.minimum = -self.posMinMax
        self.positionZSlider.maximum = self.posMinMax
        self.positionZSlider.majorTickSpacing = ticksMajor
        self.positionZSlider.minorTickSpacing = ticksMinor
        self.positionZSlider.paintTicks = True
        self.positionZSlider.paintLabels = True
        self.positionZSlider.snapToTicks = True
        self.positionZSlider.value = 0
        self.positionZSlider.orientation = JSlider.VERTICAL
        self.positionZSlider.stateChanged = self.whenSliderZChanged

        # Setup frame
        self.title = "Simple JMRI Audio Player"
        self.contentPane.layout = BoxLayout(self.contentPane, BoxLayout.Y_AXIS)

        # Add controls to frame - combo & buttons first
        p = JPanel(FlowLayout(FlowLayout.LEADING))
        p.add(self.sourceCombo)
        p.add(self.refreshButton)
        p.add(self.playButton)
        p.add(self.pauseButton)
        p.add(self.stopButton)
        #p.add(JLabel("Range"))
        #p.add(self.rangeSpinner)
        self.add(p)
        self.add(Box.createVerticalGlue())

        # Now sliders
        p = JPanel(FlowLayout(FlowLayout.LEADING))
        label = JLabel("Y Position")
        label.UI = VerticalLabelUI() # Default behaviour is anti-clockwise
        p.add(label)
        p.add(self.positionYSlider)
        p2 = JPanel()
        p2.layout = BoxLayout(p2, BoxLayout.Y_AXIS)
        p3 = JPanel()
        p3.add(JLabel("Range"))
        p3.add(self.rangeSpinner)
        p2.add(p3)
        #p2.add(Box.createVerticalGlue())
        p3 = JPanel()
        p3.layout = BoxLayout(p3, BoxLayout.Y_AXIS)
        label = JLabel("X Position")
#.........这里部分代码省略.........
开发者ID:AndTH,项目名称:JMRI,代码行数:103,代码来源:AudioPlayer.py


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