def __init__(self): # constructor #origing of coordinates self.coordx = 10 self.coordy = 10 #inintialize values self.Canvas = None #create panel (what is inside the GUI) self.panel = self.getContentPane() self.panel.setLayout(GridLayout(9, 2)) self.setTitle('Subdividing ROIs') #define buttons here: self.Dapi_files = DefaultListModel() mylist = JList(self.Dapi_files, valueChanged=self.open_dapi_image) #mylist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); mylist.setLayoutOrientation(JList.VERTICAL) mylist.setVisibleRowCount(-1) listScroller1 = JScrollPane(mylist) listScroller1.setPreferredSize(Dimension(300, 80)) self.output_files = DefaultListModel() mylist2 = JList(self.output_files) #mylist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); mylist2.setLayoutOrientation(JList.VERTICAL) mylist2.setVisibleRowCount(-1) listScroller2 = JScrollPane(mylist2) listScroller2.setPreferredSize(Dimension(300, 80)) quitButton = JButton("Quit", actionPerformed=self.quit) selectInputFolderButton = JButton("Select Input", actionPerformed=self.select_input) cubifyROIButton = JButton("Cubify ROI", actionPerformed=self.cubify_ROI) saveButton = JButton("Save ROIs", actionPerformed=self.save) summsaveButton = JButton("Save Summary", actionPerformed=self.save_summary) self.textfield1 = JTextField('500') #add buttons here self.panel.add(listScroller1) self.panel.add(listScroller2) self.panel.add(selectInputFolderButton) self.panel.add(Label("Adjust the size of the ROIs")) self.panel.add(self.textfield1) self.panel.add(cubifyROIButton) self.panel.add(saveButton) self.panel.add(summsaveButton) self.panel.add(quitButton) #self.panel.add(saveButton) #self.panel.add(Zslider) #other stuff to improve the look self.pack() # packs the frame self.setVisible(True) # shows the JFrame self.setLocation(self.coordx, self.coordy)
def __init__(self): self.setBorder( BorderFactory.createTitledBorder( "Registered session handling actions" ) ) self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) self._rowpanel1 = JPanel() self._rowpanel1.setLayout(BoxLayout(self._rowpanel1, BoxLayout.X_AXIS)) self.listModel = DefaultListModel() self.List = JList(self.listModel) self.List.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ) self.List.setSelectedIndex(0) self.List.setVisibleRowCount(5) self.ScrollPane = JScrollPane(self.List) self.remove_button = JButton( "De-register selected", actionPerformed=self.button_remove_pressed ) self._rowpanel1.add(self.ScrollPane) self._rowpanel1.add(self.remove_button) self.add(self._rowpanel1)
def run( self ) : frame = JFrame( 'List3', size = ( 200, 200 ), layout = BorderLayout(), defaultCloseOperation = JFrame.EXIT_ON_CLOSE ) data = ( 'Now is the time for all good spam ' + 'to come to the aid of their eggs' ).split( ' ' ) self.info = JList( data ) frame.add( JScrollPane( self.info, preferredSize = ( 200, 110 ) ), BorderLayout.NORTH ) panel = JPanel( layout = GridLayout( 0, 2 ) ) panel.add( JButton( 'Count', actionPerformed = self.count ) ) self.text = panel.add( JTextField( 10 ) ) frame.add( panel, BorderLayout.CENTER ) self.msg = JLabel( 'Occurance count' ) frame.add( self.msg, BorderLayout.SOUTH ) frame.setVisible( 1 )
def getUiComponent(self): """Burp uses this method to obtain the component that should be used as the contents of the custom tab when it is displayed. Returns a awt.Component. """ # GUI happens here from javax.swing import (JPanel, JSplitPane, JLabel, JList, JScrollPane, ListSelectionModel) from java.awt import BorderLayout panel = JPanel(BorderLayout()) # create a list and then JList out of it. colors = [ "red", "orange", "yellow", "green", "cyan", "blue", "pink", "magenta", "gray", "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" ] list1 = JList(colors) # set the selection mode to single items # ListSelectionModel.SINGLE_SELECTION = 0 # https://docs.oracle.com/javase/8/docs/api/constant-values.html list1.selectionMode = ListSelectionModel.SINGLE_SELECTION # create splitpane - horizontal split spl = JSplitPane(JSplitPane.HORIZONTAL_SPLIT, JScrollPane(list1), JLabel("right pane")) panel.add(spl) return panel
def __init__(self, out_of_scope): ColumnPanel.__init__(self) out_of_scope_list = JList(tuple(out_of_scope)) self.add(JScrollPane(out_of_scope_list)) self.setBorder(make_title_border("Out of scope")) self.setMaximumSize(Dimension(9999999, self.getPreferredSize().height))
def run(self): frame = JFrame('List6', size=(200, 220), layout=GridLayout(1, 2), defaultCloseOperation=JFrame.EXIT_ON_CLOSE) panel = JPanel(layout=GridLayout(0, 1)) self.buttons = {} for name in 'First,Last,Before,After,Remove'.split(','): self.buttons[name] = panel.add(self.button(name)) self.text = panel.add(JTextField(10)) self.addInputMethodListener(self) # self.addTextListener( self ) frame.add(panel) data = ('Now is the time for all good spam ' + 'to come to the aid of their eggs').split(' ') model = DefaultListModel() for word in data: model.addElement(word) self.info = JList(model, valueChanged=self.selection, selectionMode=ListSelectionModel.SINGLE_SELECTION) frame.add(JScrollPane(self.info, preferredSize=(200, 100))) frame.setVisible(1)
def run(self): frame = JFrame('List1', size=(250, 200), defaultCloseOperation=JFrame.EXIT_ON_CLOSE) data = 'Now is the time for all good spam'.split(' ') frame.add(JList(data)) frame.setVisible(1)
def getUiComponent(self): """Burp uses this method to obtain the component that should be used as the contents of the custom tab when it is displayed. Returns a awt.Component. """ # GUI happens here from javax.swing import (JPanel, JSplitPane, JLabel, JList, JScrollPane, ListSelectionModel) from java.awt import BorderLayout panel = JPanel(BorderLayout()) # create a list and then JList out of it. colors = [ "red", "orange", "yellow", "green", "cyan", "blue", "pink", "magenta", "gray", "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" ] def listSelect(event): """Add the selected index to the label.""" label1.text += "-" + colors[list1.selectedIndex] # create a list and assign the valueChanged list1 = JList(colors, valueChanged=listSelect) list1.selectionMode = ListSelectionModel.SINGLE_SELECTION # create splitpane - horizontal split label1 = JLabel("right pane") spl = JSplitPane(JSplitPane.HORIZONTAL_SPLIT, JScrollPane(list1), label1) panel.add(spl) return panel
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
def run( self ) : frame = JFrame( 'List1a', size = ( 250, 200 ), defaultCloseOperation = JFrame.EXIT_ON_CLOSE ) frame.add( JList( self.data() ) ) frame.setVisible( 1 )
def __init__(self, message, options): self._selection_list = JList(options) self._selection_list.setVisibleRowCount(4) selected_message = JLabel(message) panel = JPanel(layout=GridLayout(2, 1)) panel.add(selected_message) panel.add(JScrollPane(self._selection_list)) pane = WrappedOptionPane(panel, PLAIN_MESSAGE, OK_CANCEL_OPTION) _SwingDialog.__init__(self, pane)
def getUiComponent(self): self.spePanel = JPanel() self.spePanel.setBorder(None) self.spePanel.setLayout(None) self.logPane = JScrollPane() self.outputTxtArea = JTextArea() self.outputTxtArea.setFont(Font("Consolas", Font.PLAIN, 12)) self.outputTxtArea.setLineWrap(True) self.logPane.setViewportView(self.outputTxtArea) self.spePanel.add(self.logPane) self.clearBtn = JButton("Clear", actionPerformed=self.clearRst) self.exportBtn = JButton("Export", actionPerformed=self.exportRst) self.parentFrm = JFileChooser() self.spePanel.add(self.clearBtn) self.spePanel.add(self.exportBtn) self.logPane.setBounds(20, 50, 800, 600) self.clearBtn.setBounds(20, 650, 100, 30) self.exportBtn.setBounds(600, 650, 100, 30) self.sensitiveParamsRegularListPanel = JList(self.sensitiveParamR) self.sensitiveParamsRegularListPanel.setVisibleRowCount( len(self.sensitiveParamR)) #self.spePanel.add(self.sensitiveParamsRegularListPanel) #self.sensitiveParamsRegularListPanel.setBounds(850,50,150,600) self.sensitiveParamsRegularListScrollPanel = JScrollPane() self.sensitiveParamsRegularListScrollPanel.setViewportView( self.sensitiveParamsRegularListPanel) self.spePanel.add(self.sensitiveParamsRegularListScrollPanel) self.sensitiveParamsRegularListScrollPanel.setBounds(850, 50, 150, 600) self.addAndSaveNewParamRegularButton = JButton( 'add&&save', actionPerformed=self.addAndSaveNewParamRegular) self.spePanel.add(self.addAndSaveNewParamRegularButton) self.addAndSaveNewParamRegularButton.setBounds(1000, 50, 150, 30) self.addAndSaveNewParamRegularTextField = JTextField('NewParamRegular') self.spePanel.add(self.addAndSaveNewParamRegularTextField) self.addAndSaveNewParamRegularTextField.setBounds(1150, 50, 100, 30) self.alertSaveSuccess = JOptionPane() self.spePanel.add(self.alertSaveSuccess) self.delParamRegularButton = JButton( "delete", actionPerformed=self.delParamRegular) self.spePanel.add(self.delParamRegularButton) self.delParamRegularButton.setBounds(1000, 90, 100, 30) return self.spePanel
def __init__(self): # constructor # origing of coordinates self.coordx = 10 self.coordy = 10 # inintialize values self.Canvas = None self.default_naming = 'MouseID_ExperimentalGroup_slide-X' # create panel (what is inside the GUI) self.panel = self.getContentPane() self.panel.setLayout(GridLayout(8, 2)) self.setTitle('Subdividing ROIs') # define buttons here: self.subimage_number = DefaultListModel() mylist = JList(self.subimage_number, valueChanged=self.open_lowres_image) # mylist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); mylist.setLayoutOrientation(JList.VERTICAL) mylist.setVisibleRowCount(1) listScroller1 = JScrollPane(mylist) listScroller1.setPreferredSize(Dimension(200, 90)) quitButton = JButton("Quit", actionPerformed=self.quit) selectInputFolderButton = JButton("Select Input", actionPerformed=self.select_input) cubifyROIButton = JButton("Cubify ROI", actionPerformed=self.cubify_ROI) saveButton = JButton("Save ROIs", actionPerformed=self.save_ROIs) self.textfield1 = JTextField('18') self.textfield2 = JTextField(self.default_naming) self.textfield3 = JTextField('R-Tail') self.textfield4 = JTextField('6, 4, 22.619') self.textfield5 = JTextField('0') # add buttons here self.panel.add(Label("Name your image, or use filename")) self.panel.add(self.textfield2) self.panel.add(selectInputFolderButton) self.panel.add(listScroller1) self.panel.add(Label("Adjust the size of the squared ROIs")) self.panel.add(self.textfield1) self.panel.add(Label("give a name of your hand-drawn ROI")) self.panel.add(self.textfield3) self.panel.add(Label("For ARA: piram, ch, res")) # piramid number (high to low), channel number, final resolution (um/px)")) self.panel.add(self.textfield4) self.panel.add(Label("Piramid to check (0:none; 1:highest)")) self.panel.add(self.textfield5) self.panel.add(cubifyROIButton) self.panel.add(saveButton) self.panel.add(quitButton) # other stuff to improve the look self.pack() # packs the frame self.setVisible(True) # shows the JFrame self.setLocation(self.coordx, self.coordy)
def check(self, e): is_list = type(self.component) == type(JList()) if is_list: is_selection = self.component.getSelectedValue() != None is_trigger = e.isPopupTrigger() is_context_menu = is_selection and is_trigger index = self.component.locationToIndex(e.getPoint()) self.component.setSelectedIndex(index) self.context_menu.show(self.component, e.getX(), e.getY())
def initEnforcementDetector(self): # ## init enforcement detector tab # # These two variable appears to be unused... self.EDFP = ArrayList() self.EDCT = ArrayList() EDLType = JLabel("Type:") EDLType.setBounds(10, 10, 140, 30) EDLContent = JLabel("Content:") EDLContent.setBounds(10, 50, 140, 30) EDLabelList = JLabel("Filter List:") EDLabelList.setBounds(10, 165, 140, 30) EDStrings = [ "Headers (simple string): (enforced message headers contains)", "Headers (regex): (enforced messege headers contains)", "Body (simple string): (enforced messege body contains)", "Body (regex): (enforced messege body contains)", "Full request (simple string): (enforced messege contains)", "Full request (regex): (enforced messege contains)", "Content-Length: (constant Content-Length number of enforced response)" ] self.EDType = JComboBox(EDStrings) self.EDType.setBounds(80, 10, 430, 30) self.EDText = JTextArea("", 5, 30) self.EDText.setBounds(80, 50, 300, 110) self.EDModel = DefaultListModel() self.EDList = JList(self.EDModel) self.EDList.setBounds(80, 175, 300, 110) self.EDList.setBorder(LineBorder(Color.BLACK)) self.EDAdd = JButton("Add filter", actionPerformed=self.addEDFilter) self.EDAdd.setBounds(390, 85, 120, 30) self.EDDel = JButton("Remove filter", actionPerformed=self.delEDFilter) self.EDDel.setBounds(390, 210, 120, 30) self.EDPnl = JPanel() self.EDPnl.setLayout(None) self.EDPnl.setBounds(0, 0, 1000, 1000) self.EDPnl.add(EDLType) self.EDPnl.add(self.EDType) self.EDPnl.add(EDLContent) self.EDPnl.add(self.EDText) self.EDPnl.add(self.EDAdd) self.EDPnl.add(self.EDDel) self.EDPnl.add(EDLabelList) self.EDPnl.add(self.EDList)
def testBuiltinListener(): model = DefaultListModel() lst = JList(model) model.addElement(u'Test') events = [] addEventListener(lst, ListSelectionListener, 'valueChanged', events.append) lst.setSelectionInterval(0, 0) assert len(events) == 1 assert events[0].firstIndex == 0 assert events[0].lastIndex == 0
def __init__(self, frame, textComponent): JWindow.__init__(self, frame) self.textComponent = textComponent self.size = (200, 200) self.list = JList(keyPressed=self.key) self.list.setBackground(Color(255, 255, 225)) # TODO move this color self.getContentPane().add(JScrollPane(self.list)) self.list.setSelectedIndex(0) self.originalData = "" self.data = "" self.typed = ""
def testListSelectionEventKwargs(): def selectionListener(event, **kwargs): holder[0] = kwargs model = DefaultListModel() lst = JList(model) model.addElement(u'Test') holder = [None] addEventListener(lst, ListSelectionListener, 'valueChanged', selectionListener, test=2) lst.setSelectionInterval(0, 0) assert holder[0] == {'test': 2}
def testListSelectionEventVarargs(): def selectionListener(*args): _event, holder[0] = args model = DefaultListModel() lst = JList(model) model.addElement(u'Test') holder = [None] addEventListener(lst, ListSelectionListener, 'valueChanged', selectionListener, 2) lst.setSelectionInterval(0, 0) assert holder[0] == 2
def __init__(self, burp_callbacks): self._burp_callbacks = burp_callbacks self._type_list_component = JList( blackboxprotobuf.known_messages.keys()) self._type_list_component.setSelectionMode( ListSelectionModel.SINGLE_SELECTION) self._component = JSplitPane(JSplitPane.HORIZONTAL_SPLIT) self._component.setLeftComponent(JScrollPane( self._type_list_component)) self._component.setRightComponent(self.createButtonPane()) self._component.setResizeWeight(0.9)
def getUiComponent(self): """Burp uses this method to obtain the component that should be used as the contents of the custom tab when it is displayed. Returns a awt.Component. """ # GUI happens here from javax.swing import (JPanel, JSplitPane, JList, JTextPane, JScrollPane, ListSelectionModel, JLabel, JTabbedPane, JEditorPane) from java.awt import BorderLayout panel = JPanel(BorderLayout()) # create a list and then JList out of it. colors = [ "red", "orange", "yellow", "green", "cyan", "blue", "pink", "magenta", "gray", "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" ] def listSelect(event): """Add the selected index to the label. Called twice when selecting the list item by mouse. So we need to use getValueIsAdjusting inside. """ if not event.getValueIsAdjusting(): doc1.insertString(0, colors[list1.selectedIndex] + "-", None) # create a list and assign the valueChanged list1 = JList(colors, valueChanged=listSelect) list1.selectionMode = ListSelectionModel.SINGLE_SELECTION # create a StyledDocument. from javax.swing.text import DefaultStyledDocument doc1 = DefaultStyledDocument() # create a JTextPane from doc1 tab1 = JTextPane(doc1) # create a JEditorPane for tab 2 tab2 = JEditorPane("https://example.net") tab2.editable = False # create the tabbedpane tabs = JTabbedPane() tabs.addTab("Tab 1", tab1) tabs.addTab("Tab 2", tab2) # create splitpane - horizontal split spl = JSplitPane(JSplitPane.HORIZONTAL_SPLIT, JScrollPane(list1), tabs) panel.add(spl) return panel
def run(self): #----------------------------------------------------------------------- # Size the frame to use 1/2 of the screen #----------------------------------------------------------------------- screenSize = Toolkit.getDefaultToolkit().getScreenSize() frameSize = Dimension(screenSize.width >> 1, screenSize.height >> 1) frame = JFrame('javadocInfo', size=frameSize, defaultCloseOperation=JFrame.EXIT_ON_CLOSE) #----------------------------------------------------------------------- # Reposition the frame to be in the center of the screen #----------------------------------------------------------------------- frame.setLocation((screenSize.width - frameSize.width) >> 1, (screenSize.height - frameSize.height) >> 1) #----------------------------------------------------------------------- # Initialize the list to have exactly 1 element #----------------------------------------------------------------------- self.List = JList(['One moment please...'], valueChanged=self.pick, selectionMode=ListSelectionModel.SINGLE_SELECTION) #----------------------------------------------------------------------- # Put the List in a ScrollPane and place it in the middle of a pane #----------------------------------------------------------------------- pane = JPanel(layout=BorderLayout()) pane.add(JScrollPane(self.List), BorderLayout.CENTER) #----------------------------------------------------------------------- # Add a TextField [for the URL of the selected entry] at the bottom #----------------------------------------------------------------------- self.msg = JTextField() pane.add(self.msg, BorderLayout.SOUTH) #----------------------------------------------------------------------- # Add the pane and a scrollable TextArea to a SplitPane in the frame #----------------------------------------------------------------------- self.area = JTextArea() sPane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT, pane, JScrollPane(self.area), propertyChange=self.propChange) sPane.setDividerLocation(234) frame.add(sPane) #----------------------------------------------------------------------- # Create a separate thread to locate & proces the remote URL #----------------------------------------------------------------------- self.Links = {} # Initialize the Links dictionary soupTask( self.List, # The visible JList instance self.msg, # The message area (JTextField) JAVADOC_URL, # Remote web page URL to be processed self.Links # Dictionary of links found ).execute() frame.setVisible(1)
def __init__(self): self.programs = [] self.setLayout(BoxLayout(self, BoxLayout.PAGE_AXIS)) self.JprogramList = JList() self.JprogramList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION) self.JprogramList.addListSelectionListener(self.handle_select) scrollPane = JScrollPane(self.JprogramList) scrollPane.setMinimumSize(Dimension(300, 0)) self.splitPane = SplitPanel(scrollPane, JPanel()) self.add(self.splitPane) context.addon.register_on_connect(self.load_program_list) context.addon.register_on_error(self.display_error)
def testListSelectionEvent(): def selectionListener(event): eventHolder[0] = event model = DefaultListModel() lst = JList(model) model.addElement(u'Test') eventHolder = [None] addEventListener(lst, ListSelectionListener, 'valueChanged', selectionListener) lst.setSelectionInterval(0, 0) event = eventHolder[0] assert event.firstIndex == 0 assert event.lastIndex == 0
def initInterceptionFilters(self): # ## init interception filters tab # IFStrings = [ "Scope items only: (Content is not required)", "URL Contains (simple string): ", "URL Contains (regex): ", "URL Not Contains (simple string): ", "URL Not Contains (regex): " ] self.IFType = JComboBox(IFStrings) self.IFType.setBounds(80, 10, 430, 30) self.IFModel = DefaultListModel() self.IFList = JList(self.IFModel) self.IFList.setBounds(80, 175, 300, 110) self.IFList.setBorder(LineBorder(Color.BLACK)) self.IFText = JTextArea("", 5, 30) self.IFText.setBounds(80, 50, 300, 110) IFLType = JLabel("Type:") IFLType.setBounds(10, 10, 140, 30) IFLContent = JLabel("Content:") IFLContent.setBounds(10, 50, 140, 30) IFLabelList = JLabel("Filter List:") IFLabelList.setBounds(10, 165, 140, 30) self.IFAdd = JButton("Add filter", actionPerformed=self.addIFFilter) self.IFAdd.setBounds(390, 85, 120, 30) self.IFDel = JButton("Remove filter", actionPerformed=self.delIFFilter) self.IFDel.setBounds(390, 210, 120, 30) self.filtersPnl = JPanel() self.filtersPnl.setLayout(None) self.filtersPnl.setBounds(0, 0, 1000, 1000) self.filtersPnl.add(IFLType) self.filtersPnl.add(self.IFType) self.filtersPnl.add(IFLContent) self.filtersPnl.add(self.IFText) self.filtersPnl.add(self.IFAdd) self.filtersPnl.add(self.IFDel) self.filtersPnl.add(IFLabelList) self.filtersPnl.add(self.IFList)
def getUiComponent(self): """Burp uses this method to obtain the component that should be used as the contents of the custom tab when it is displayed. Returns a awt.Component. """ # GUI happens here from javax.swing import (JPanel, JSplitPane, JList, JScrollPane, ListSelectionModel, JLabel, JTabbedPane) from java.awt import BorderLayout panel = JPanel(BorderLayout()) # create a list and then JList out of it. colors = [ "red", "orange", "yellow", "green", "cyan", "blue", "pink", "magenta", "gray", "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" ] def listSelect(event): """Add the selected index to the label. Called twice when selecting the list item by mouse. So we need to use getValueIsAdjusting inside. """ if not event.getValueIsAdjusting(): label1.text += "-" + colors[list1.selectedIndex] # create a list and assign the valueChanged list1 = JList(colors, valueChanged=listSelect) list1.selectionMode = ListSelectionModel.SINGLE_SELECTION # create a JTabbedPane tabs = JTabbedPane() # add labels to it label1 = JLabel() label2 = JLabel() tabs.addTab("Tab 1", label1) tabs.addTab("Tab 2", label2) # create splitpane - horizontal split spl = JSplitPane(JSplitPane.HORIZONTAL_SPLIT, JScrollPane(list1), tabs) panel.add(spl) return panel
def __init__(self, extension, burp_callbacks): self._burp_callbacks = burp_callbacks self._extension = extension self._type_list_component = JList(extension.known_message_model) self._type_list_component.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) self._component = JPanel() self._component.setLayout(BoxLayout(self._component, BoxLayout.Y_AXIS)) splitPane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT) splitPane.setRightComponent(JScrollPane(self._type_list_component)) splitPane.setLeftComponent(self.createButtonPane()) splitPane.setResizeWeight(0.03) splitPane.setMaximumSize(Dimension(1000, 1000)) self._component.add(splitPane) self._component.add(Box.createVerticalGlue()) self._component.setBorder(EmptyBorder(10, 10, 10, 10))
def run(self): frame = JFrame('javadocInfo_02', locationRelativeTo=None, size=(350, 225), defaultCloseOperation=JFrame.EXIT_ON_CLOSE) model = DefaultListModel() model.addElement('One moment please...') self.List = JList(model, valueChanged=self.pick, selectionMode=ListSelectionModel.SINGLE_SELECTION) frame.add(JScrollPane(self.List), BorderLayout.CENTER) self.msg = JTextField() frame.add(self.msg, BorderLayout.SOUTH) self.Links = {} soupTask( self.List, # The visible JList instance self.msg, # The message area (JTextField) JAVADOC_URL, # Remote web page URL to be processed self.Links # Dictionary of links found ).execute() frame.setVisible(1)
def testJList(self): personList = [self.person] personList.append(Person(u'Mary', u'Mediocre', 1970)) personList.append(Person(u'Bob', u'Mediocre', 1972)) listModel = DelegateListModel(personList) jlist = JList(listModel) self.group.bind(jlist, u'selectedValue.firstName', self.dummy, u'value') jlist.selectedIndex = 1 assert jlist.selectedValue == personList[1] assert self.dummy.value == u'Mary' jlist.selectedIndex = 2 assert jlist.selectedValue == personList[2] assert self.dummy.value == u'Bob' jlist.setSelectedValue(self.person, False) assert jlist.selectedIndex == 0 assert self.dummy.value == u'Joe'
def run(self): frame = JFrame('List4', size=(200, 222), layout=BorderLayout(), defaultCloseOperation=JFrame.EXIT_ON_CLOSE) data = ('Now is the time for all good spam ' + 'to come to the aid of their eggs').split(' ') self.info = JList(data, selectionMode=ListSelectionModel.SINGLE_SELECTION) # self.info = JList( data ) frame.add(JScrollPane(self.info, preferredSize=(200, 100)), BorderLayout.NORTH) panel = JPanel(layout=GridLayout(0, 2)) self.text = panel.add(JTextField(10)) panel.add(self.button('First')) panel.add(self.button('Last')) panel.add(self.button('Before')) panel.add(self.button('After')) panel.add(self.button('Remove')) frame.add(panel, BorderLayout.SOUTH) frame.setVisible(1)