コード例 #1
0
ファイル: menu.py プロジェクト: ctn-waterloo/nengo_java_gui
    def addSection(self, name, fontstyle=None):
        """Creates a new section in the Popup menu."""
        if self.isFirstSection:
            self.isFirstSection = False
        else:
            self.menu.addSeparator()  # menu.add(JSeparator()) ???

        label = JLabel(name)
        label.setLocation(4, 4)
        if fontstyle is not None:
            label.font = fontstyle
        self.applyStyle(label)
        self.menu.add(label)
コード例 #2
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