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


Python swing.JScrollPane类代码示例

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


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

示例1: getControlPanel

def getControlPanel():
    global controlPanel
    controlPanel = JPanel()
    controlPanel.setLayout(BoxLayout(controlPanel, BoxLayout.Y_AXIS))
    for row in keyLayout:
        rowPanel = JPanel()
        rowPanel.setLayout(BoxLayout(rowPanel, BoxLayout.X_AXIS))
        controlPanel.add(rowPanel)
        for key in row:
            button = JButton(key[0], actionPerformed=handleKeyButton)
            button.setActionCommand(key[1])
            rowPanel.add(button)

    global terminalResult
    terminalResult = JTextArea()
    scroller = JScrollPane(terminalResult)
    terminalResult.setLineWrap(True)
    scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS)
    scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)
    controlPanel.add(scroller)

    global terminalInput
    termInputPanel = JPanel()
    termInputPanel.setLayout(BoxLayout(termInputPanel, BoxLayout.X_AXIS))
    termInputLabel = JLabel("Command")
    termInputPanel.add(termInputLabel)
    terminalInput = JTextField(actionPerformed=handleTerminalInput)
    minimumSize = terminalInput.getMinimumSize()
    maximumSize = terminalInput.getMaximumSize()
    terminalInput.setMaximumSize(Dimension(maximumSize.width, minimumSize.height))

    termInputPanel.add(terminalInput)
    controlPanel.add(termInputPanel)

    return controlPanel
开发者ID:sjp38,项目名称:ash,代码行数:35,代码来源:ashdi.py

示例2: __init__

 def __init__(self, controller):
     '''
     Creates default empty text area in a panel.
     It will contain the ATF file content, and allow text edition.
     It should highlight reserved words and suggest autocompletion or 
     possible typos, a la IDEs like Eclipse.
     It might need refactoring so that there is a parent panel with two modes
     or contexts, depending on user choice: text view or model view.
     '''
     #Give reference to controller to delegate action response
     self.controller = controller
     
     #Make text area occupy all available space and resize with parent window
     self.setLayout(BorderLayout())
     
     #Create text edition area
     self.editArea = JTextArea()
     self.editArea.border = BorderFactory.createEmptyBorder(4,4,4,4)
     self.editArea.font = Font("Monaco", Font.PLAIN, 14)
     
     #Will need scrolling controls
     scrollingText = JScrollPane(self.editArea)
     scrollingText.setPreferredSize(Dimension(1,500))
     
     #Add to parent panel
     self.add(scrollingText, BorderLayout.CENTER)
 
     
开发者ID:jenshnielsen,项目名称:nammu,代码行数:26,代码来源:AtfAreaView.py

示例3: __init__

 def __init__(self):
     # Panel for Measurements
     self.setLayout(BorderLayout())
     # PAGE_START
     ''' show group/dataset names in the list (component/variable) names '''
     self.cbfilemeasOut = JComboBox([])
     bfilemeasOut= JButton('Measurements', actionPerformed= self.loadMeasOut)
     p3= JPanel()
     p3.setLayout(GridLayout(1,2))
     p3.add(self.cbfilemeasOut)
     p3.add(bfilemeasOut)
     self.add(p3, BorderLayout.PAGE_START)
     # LINE_START
     root = DefaultMutableTreeNode('VarMeasurements')
     self.tree = JTree(root)
     scrollPane = JScrollPane()  # add a scrollbar to the viewport
     scrollPane.setPreferredSize(Dimension(230,320))
     scrollPane.getViewport().setView((self.tree))
     p4 = JPanel()
     p4.add(scrollPane)
     self.add(p4, BorderLayout.LINE_START)
     # CENTER
     ''' represent a signal with matplot lib in textarea places '''
     graficMeas= JTextArea()
     self.add(graficMeas, BorderLayout.CENTER)
开发者ID:fran-jo,项目名称:SimuGUI,代码行数:25,代码来源:maegui_jy.py

示例4: ConsoleTab

class ConsoleTab(ITab):

    def __init__(self, burp):
        self.burp = burp
        self.log = burp.log
        self.config = burp.config

        self.caption = burp.loadExtensionSetting(*settings.CONSOLE_CAPTION)
        self.scrollpane = JScrollPane()

        self.console = Console(burp)
        self.scrollpane.setViewportView(self.console.textpane)
        
        self.burp.addSuiteTab(self)
        self.burp.customizeUiComponent(self.getUiComponent())

    def getUiComponent(self):
        return self.scrollpane

    def getTabCaption(self):
        return self.caption

    @property
    def interpreter(self):
        return self.console.interp
开发者ID:coffeetocode,项目名称:jython-burp-api,代码行数:25,代码来源:ui.py

示例5: p_build_ui

    def p_build_ui(self, event):
        """
        Adds a list of checkboxes, one for each loaded plugin
        to the Selct plugins window
        """
        if not self.loaded_p_list:
            self.update_scroll("[!!] No plugins loaded!")
            return

        scroll_pane = JScrollPane()
        scroll_pane.setPreferredSize(Dimension(200, 250))
        check_frame = JPanel(GridBagLayout())
        constraints = GridBagConstraints()
        constraints.fill = GridBagConstraints.HORIZONTAL
        constraints.gridy = 0
        constraints.anchor = GridBagConstraints.FIRST_LINE_START

        for plug in self.loaded_p_list:
            check_frame.add(JCheckBox(plug.get_name(), plug.enabled,
                                      actionPerformed=self.update_box),
                            constraints)
            constraints.gridy += 1

        vport = JViewport()
        vport.setView(check_frame)
        scroll_pane.setViewport(vport)
        self.window.contentPane.add(scroll_pane)
        self.window.pack()
        self.window.setVisible(True)
开发者ID:aur3lius-dev,项目名称:SpyDir,代码行数:29,代码来源:SpyDir.py

示例6: __init__

    def __init__(self):
        super(AboutDialog, self).__init__()

        # Open the files and build a tab pane
        self.tabbedPane = tabs = JTabbedPane()

        for title, path in self.INFO_FILES:
            textPane = JTextPane()
            textPane.editable = False
            scrollPane = JScrollPane(textPane)
            scrollPane.preferredSize = (32767, 32767)   # just a large number

            with open(path, 'r') as fd:
                infoText = fd.read().decode('utf8')
                textPane.text = infoText

            textPane.caretPosition = 0
            tabs.addTab(title, scrollPane)

        # Load this tabbed pane into the layout
        self.add(tabs, BorderLayout.CENTER)

        # Add a label at the top
        versionLabel = JLabel(JESVersion.TITLE + " version " + JESVersion.RELEASE)
        versionLabel.alignmentX = Component.CENTER_ALIGNMENT

        versionPanel = JPanel()
        versionPanel.add(versionLabel)
        self.add(versionPanel, BorderLayout.PAGE_START)

        # Make an OK button
        self.okButton = JButton(self.ok)
        self.buttonPanel.add(self.okButton)
开发者ID:HenryStevens,项目名称:jes,代码行数:33,代码来源:about.py

示例7: BurpExtender

class BurpExtender(IBurpExtender, IExtensionStateListener, IHttpListener, IProxyListener, ITab):
    def registerExtenderCallbacks(self, callbacks):
        self.callbacks = callbacks
        self.helpers = callbacks.helpers

        self.scriptpane = JTextPane()
        self.scriptpane.setFont(Font('Monospaced', Font.PLAIN, 11))

        self.scrollpane = JScrollPane()
        self.scrollpane.setViewportView(self.scriptpane)

        self._code = compile('', '<string>', 'exec')
        self._script = ''

        callbacks.registerExtensionStateListener(self)        
        callbacks.registerProxyListener(self)
        callbacks.customizeUiComponent(self.getUiComponent())
        callbacks.addSuiteTab(self)

        self.scriptpane.requestFocus()

    def extensionUnloaded(self):
        try:
            self.callbacks.saveExtensionSetting(
                'script', base64.b64encode(self._script))
        except Exception:
            traceback.print_exc(file=self.callbacks.getStderr())
        return

    def processProxyMessage(self, messageIsRequest, message):
        try:
            globals_ = {'extender': self,
                        'callbacks': self.callbacks,
                        'helpers': self.helpers
            }
            locals_  = {'messageIsRequest': messageIsRequest,
                        'message': message
            }
            exec(self.script, globals_, locals_)
        except Exception:
            traceback.print_exc(file=self.callbacks.getStderr())
        return
        
    def getTabCaption(self):
        return 'Script'

    def getUiComponent(self):
        return self.scrollpane

    @property
    def script(self):
        end = self.scriptpane.document.length
        _script = self.scriptpane.document.getText(0, end)

        if _script == self._script:
            return self._code

        self._script = _script
        self._code = compile(_script, '<string>', 'exec')
        return self._code
开发者ID:Izib,项目名称:ProxyScripter,代码行数:60,代码来源:ProxyScripter.py

示例8: __init__

 def __init__(self, controller):
     '''
     Creates default empty console-looking panel.
     It should be separated from the rest of the GUI so that users can choose
     to show or hide the console. Or should it be a split panel?
     This panel will display log and validation/lemmatization messages.
     It might need its own toolbar for searching, etc.
     It will also accept commands in later stages of development, if need be.
     '''
     
     #Give reference to controller to delegate action response
     self.controller = controller
     
     #Make text area occupy all available space and resize with parent window
     self.setLayout(BorderLayout())
     
     #Create console-looking area
     self.editArea = JTextArea()
     self.editArea.border = BorderFactory.createEmptyBorder(4,4,4,4)
     self.editArea.font = Font("Courier New", Font.BOLD, 14)
     self.editArea.background = Color.BLACK
     self.editArea.foreground = Color.WHITE
     self.editArea.text = "Console started. Nammu's log will appear here.\n\n"
     
     #Will need scrolling controls
     scrollingText = JScrollPane(self.editArea)
     scrollingText.setPreferredSize(Dimension(1,150))
     
     #Make text area auto scroll down to last printed line
     caret = self.editArea.getCaret();
     caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
     
     #Add to parent panel
     self.add(scrollingText, BorderLayout.CENTER)
开发者ID:jenshnielsen,项目名称:nammu,代码行数:34,代码来源:ConsoleView.py

示例9: __initTable

 def __initTable(self):
     table = JTable(HitListModel())
     scrollpane = JScrollPane(table)
     table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF)
     table.addMouseListener(HitListMouseListener())
     self.add(scrollpane, self.__createTableConstraints())
     scrollpane.addComponentListener(PanelSizeChangeListener(table))
     return table
开发者ID:carvalhomb,项目名称:tsmells,代码行数:8,代码来源:StinkParade.py

示例10: createList

 def createList(self, content):
     model = DefaultListModel()
     for elem in content:
         model.addElement(elem)
     list = JList(model)
     listPane = JScrollPane(list) 
     listPane.setPreferredSize(Dimension(250, 400))
     return listPane, list, model
开发者ID:samitha,项目名称:lositan,代码行数:8,代码来源:RestrictElements.py

示例11: fillPanel

 def fillPanel(self, question):
     self.pnlQuestion.removeAll()
     if question.getKind() == 2:
         panel = TrueFalsePanel(question).getPanel()
     elif question.getKind() == 3:
         panel = MultipleChoicePanel(question).getPanel()
     scrollpanel = JScrollPane(panel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED)
     scrollpanel.setBorder(None)
     self.pnlQuestion.add(scrollpanel, BorderLayout.CENTER)
     self.pnlQuestion.updateUI()
开发者ID:nacho0605,项目名称:GSoC,代码行数:10,代码来源:gameplayer.py

示例12: __init__

    def __init__(self, window, api):
        self.api = api
        self.component = JPanel(BorderLayout())

        # Create editor pane
        scrollpane = JScrollPane()
        self.script_area = InputPane(window)
        self.script_area.undo = UndoManager()
        line_numbers = LineNumbering(self.script_area.component)
        scrollpane.viewport.view = self.script_area.component
        scrollpane.rowHeaderView = line_numbers.component
        self.component.add(scrollpane, BorderLayout.CENTER)

        # Create Selection pane
        select_pane = JPanel()
        self.objects_box = JComboBox([], actionCommand="object")
        select_pane.add(self.objects_box)
        self.events_box = JComboBox(
            ["update", "click"],
            actionCommand="event"
        )
        self.event_types = [EventType.UPDATE, EventType.CLICK]
        select_pane.add(self.events_box)
        self.languages = list(ScriptType.values())
        self.language_box = JComboBox(
            [l.getName() for l in self.languages],
            actionCommand="language"
        )        
        select_pane.add(self.language_box)
        self.save_btn = JButton("Save")
        select_pane.add(self.save_btn)
        self.component.add(select_pane, BorderLayout.PAGE_START)

        self.events_box.addActionListener(self)
        self.objects_box.addActionListener(self)
        self.language_box.addActionListener(self)
        self.save_btn.addActionListener(self)
        
        self.current = None
        self.update_geos()
        interface.addEventListener("add", self.event_listener)
        interface.addEventListener("remove", self.event_listener)
        interface.addEventListener("rename", self.event_listener)
        
        # Listen to script_area changes in order to know when the save
        # button can be activated
        self.script_area.doc.addDocumentListener(self)
        
        # Hack to be able to change the objects_box
        self.building_objects_box = False

        self.active = False
开发者ID:aeriksson,项目名称:geogebra,代码行数:52,代码来源:gui.py

示例13: timeline

    def timeline(self, username):
        timeline = self.api.GetFriendsTimeline(username)
        self.resultPanel = JPanel()
        self.resultPanel.layout = BoxLayout(self.resultPanel, BoxLayout.Y_AXIS)
        for s in timeline:
            self.showTweet(s)

        scrollpane = JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                 JScrollPane.HORIZONTAL_SCROLLBAR_NEVER)
        scrollpane.preferredSize = 400, 800
        scrollpane.viewport.view = self.resultPanel

        self.frame.add(scrollpane)
开发者ID:jython,项目名称:book,代码行数:13,代码来源:twitfriends.py

示例14: __init__

    def __init__(self, controller):
        '''
        Creates default empty console-looking panel.
        It should be separated from the rest of the GUI so that users can
        choose to show or hide the console. Or should it be a split panel?
        This panel will display log and validation/lemmatization messages.
        It might need its own toolbar for searching, etc.
        It will also accept commands in later stages of development, if need
        be.
        '''
        # Give reference to controller to delegate action response
        self.controller = controller

        # Make text area occupy all available space and resize with parent
        # window
        self.setLayout(BorderLayout())

        # Create console-looking area
        self.edit_area = JEditorPane()

        # Although most of the styling is done using css, we need to set these
        # properties to ensure the html is rendered properly in the console
        self.edit_area.border = BorderFactory.createEmptyBorder(6, 6, 6, 6)
        self.edit_area.setContentType("text/html")

        # Disable writing in the console - required to render hyperlinks
        self.edit_area.setEditable(False)

        # Map CSS color strings to Java Color objects
        self.colors = {'Gray': Color(238, 238, 238),
                       'Black': Color(0, 0, 0),
                       'Yellow': Color(255, 255, 0)}

        # Initial call to refresh console to set the console style properties
        self.refreshConsole()

        # Set up a hyperlink listener
        listener = addEventListener(self.edit_area, HyperlinkListener,
                                    'hyperlinkUpdate', self.handleEvent)

        # Will need scrolling controls
        scrollingText = JScrollPane(self.edit_area)
        scrollingText.setPreferredSize(Dimension(1, 150))

        # Make text area auto scroll down to last printed line
        caret = self.edit_area.getCaret()
        caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE)

        # Add to parent panel
        self.add(scrollingText, BorderLayout.CENTER)
开发者ID:oracc,项目名称:nammu,代码行数:50,代码来源:ConsoleView.py

示例15: friendsList

    def friendsList(self, username):
        
        self.window = swing.JFrame(username)
        self.window.layout = awt.BorderLayout()
        statusPanel = swing.JPanel()
        statusPanel.layout = awt.GridLayout(4,1)

        # Set status placeholder UI
        statusPanel.border = swing.BorderFactory.createTitledBorder("Status")
        buttonGroup = swing.ButtonGroup()
        radioButton = swing.JRadioButton("Away", actionPerformed=self.radioCallback)
        buttonGroup.add(radioButton)
        statusPanel.add(radioButton)
        radioButton = swing.JRadioButton("Here", actionPerformed=self.radioCallback)
        buttonGroup.add(radioButton)
        statusPanel.add(radioButton)
        #Wizard of Oz incoming chat request
        radioButton = swing.JButton("Page Boss", actionPerformed=self.callBoss)
        buttonGroup.add(radioButton)
        statusPanel.add(radioButton)
        statusPanel.add(self.status)
        #statusPanel.add(swing.JButton("Update Status", actionPerformed=self.updateStatus))
        #Buddy list
        panel = swing.JPanel()
        panel.layout = awt.BorderLayout()
        panel.border = swing.BorderFactory.createTitledBorder("Friends Online")
        
        
        
        ##TODO: fix threading so that friends load before the window
        print self.friendsData
        self.friendsData.append('guest')
        print '2'
        
        
        
        self.list = swing.JList(self.friendsData)
        panel.add("Center", swing.JScrollPane(self.list))
        launchChatButton = swing.JButton("Launch chat?", actionPerformed=self.launchChatOut)
        panel.add("South", launchChatButton)
        self.window.windowClosing = self.goodbye
        pane = JScrollPane()
        pane.getViewport().add(self.list)
        panel.add(pane)
        self.window.add("North", statusPanel)
        self.window.add("South", panel)
        self.window.pack()
        self.window.visible = True
        return self.window
开发者ID:kfuruya,项目名称:ChatClient,代码行数:49,代码来源:gui.py


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