示例#1
0
    def createAuxPanelWrapper(self, auxPanel, auxTitle):
        # Initialize auxillary panel
        leftPanel = JPanel()
        leftPanel.layout = BorderLayout()
        leftPanel.addFocusListener(LeftFocusListener(self))

        # NengoStyle.applyStyle(leftPanel);

        if self.showTitle:
            # Create auxillary panel's title bar

            titleBar = JPanel()
            titleBar.border = BorderFactory.createEmptyBorder(0, 0, 5, 0))
            NengoStyle.applyStyle(titleBar)
            titleBar.background = NengoStyle.COLOR_BACKGROUND2
            titleBar.opaque = True
            titleBar.layout = BorderLayout()

            titleLabel = JLabel(title)

            titleLabel.font = NengoStyle.FONT_BIG
            NengoStyle.applyStyle(titleLabel)
            titleLabel.background = NengoStyle.COLOR_BACKGROUND2
            titleLabel.opaque = True

            hideButtonTxt = " >> " if self.orientation == 'right' else " << "

            hideButton = JLabel(hideButtonTxt)
            NengoStyle.applyStyle(hideButton)
            hideButton.background = NengoStyle.COLOR_BACKGROUND2
            hideButton.opaque = True

            # Keep in this order, Swing puts items added first on top.
            # We want the button to be on top
            titleBar.add(hideButton, BorderLayout.EAST)
            titleBar.add(titleLabel, BorderLayout.WEST)

            hideButton.addMouseListener(HideButtonListener(self, hideButton))

            leftPanel.add(titleBar, BorderLayout.NORTH)

        leftPanel.minimumSize = self.minimumSize

        if auxPanel is not None:
            # NengoStyle.applyStyle(auxPanel)
            leftPanel.add(auxPanel, BorderLayout.CENTER)

        return leftPanel