本文整理汇总了Python中javax.swing.JComboBox.setModel方法的典型用法代码示例。如果您正苦于以下问题:Python JComboBox.setModel方法的具体用法?Python JComboBox.setModel怎么用?Python JComboBox.setModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JComboBox
的用法示例。
在下文中一共展示了JComboBox.setModel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QatDialog
# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setModel [as 别名]
#.........这里部分代码省略.........
#icon
if self.app.favZone is not None:
self.favAreaIndicator.setIcon(self.app.favZone.icon)
#tooltip
messageArguments = array([self.app.favZone.name], String)
formatter = MessageFormat("")
formatter.applyPattern(self.app.strings.getString("favAreaIndicator_tooltip"))
msg = formatter.format(messageArguments)
self.favAreaIndicator.setToolTipText(msg)
#status
self.favAreaIndicator.setVisible(self.app.favouriteZoneStatus)
def set_checksTextFld_color(self, color):
"""Change color of textField under checksTable
"""
colors = {"white": (255, 255, 255),
"black": (0, 0, 0),
"green": (100, 200, 0),
"red": (200, 0, 0)}
if color == "default":
self.statsPanel.background = self.statsPanel_def_color
self.checksTextFld.foreground = colors["black"]
else:
self.statsPanel.background = colors[color]
self.checksTextFld.foreground = colors["white"]
def change_selection(self, source):
"""Change comboboxes and checks table selections after a
selection has been made by the user
"""
if source in ("menu", "layer", "add favourite"):
self.app.selectionChangedFromMenuOrLayer = True
self.toolsCombo.setSelectedItem(self.app.selectedTool)
self.viewsCombo.setModel(self.app.selectedTool.viewsComboModel)
self.viewsCombo.setSelectedItem(self.app.selectedView.title)
self.checksTable.setModel(self.app.selectedTableModel)
self.refresh_checksTable_columns_geometries()
for i, c in enumerate(self.app.selectedView.checks):
if c == self.app.selectedChecks[0]:
break
self.checksTable.setRowSelectionInterval(i, i)
self.app.selectionChangedFromMenuOrLayer = False
else:
self.app.selectionChangedFromMenuOrLayer = False
if source == "toolsCombo":
self.viewsCombo.setModel(self.app.selectedTool.viewsComboModel)
self.viewsCombo.setSelectedIndex(0)
elif source == "viewsCombo":
self.checksTable.setModel(self.app.selectedTableModel)
self.refresh_checksTable_columns_geometries()
if self.app.selectedView.checks != []: # favourite checks may be none
self.checksTable.setRowSelectionInterval(0, 0)
def refresh_checksTable_columns_geometries(self):
self.checksTable.getColumnModel().getColumn(0).setCellRenderer(self.iconrenderer)
self.checksTable.getColumnModel().getColumn(0).setMaxWidth(25)
self.checksTable.getColumnModel().getColumn(2).setMaxWidth(60)
def activate_error_tab(self, status):
if status:
if self.tabbedPane.getTabCount() == 1:
self.tabbedPane.addTab(self.app.strings.getString("Fix"),
None,
self.panel2,
self.app.strings.getString("fix_tab"))
示例2: BurpExtender
# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setModel [as 别名]
#.........这里部分代码省略.........
# register callbacks
callbacks.customizeUiComponent(self._jPanel)
callbacks.registerContextMenuFactory(self)
callbacks.addSuiteTab(self)
return
#
# implement ITab and Tab ChangeListener
#
def getTabCaption(self):
return "Phantom RIA Crawler"
def getUiComponent(self):
return self._jPanel
def stateChanged(self, ev):
self._configUpdated()
def _configUpdated(self, ev):
config = self._callbacks.saveConfig()
# update proxy listeners
index = 0
listeners = DefaultComboBoxModel()
while (("proxy.listener" + str(index)) in config):
listenerItem = config["proxy.listener" + str(index)]
listenerItems = listenerItem.split(".")
if (listenerItems[0] == "1"):
address = ".".join(listenerItems[2][1:].split("|"))
if (len(address) == 0):
address = "127.0.0.1"
listeners.addElement(address + " : " + listenerItems[1])
index = index + 1
self._listenersCombo.setModel(listeners)
return;
#
# implement button actions
#
def startToggled(self, ev):
if (self._startButton.getModel().isSelected()):
try:
os.chdir(sys.path[0] + os.sep + "riacrawler" + os.sep + "scripts")
except Exception as e:
print >> sys.stderr, "RIA crawler scripts loading error", "I/O error({0}): {1}".format(e.errno, e.strerror)
self._startButton.setSelected(False)
return
phantomJsPath = self._phantomJsPathField.text
target = self._addressTextField.text
config = "crawler.config"
if (self._configFile):
config = self._configFile
listenerAddress = self._listenersCombo.getSelectedItem().replace(" ", "")
p = Popen("{0} --proxy={3} main.js --target={1} --config={2}".format(phantomJsPath, target, config, listenerAddress), shell=True)
self._running = True
self._requestsMadeInfo.setText("")
self._statesFoundInfo.setText("")
self._commandClient.startCrawling()
else:
if (self._running):
self._commandClient.stopCrawling()
self._running = False
示例3: BurpExtender
# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import setModel [as 别名]
#.........这里部分代码省略.........
else:
xml_content = zin.read(item.filename)
result = re.findall("(.*)<w:body>(?:.*)<\/w:body>(.*)",xml_content)[0]
newXML = result[0]
templateBody = re.findall("<w:body>(.*)<\/w:body>", xml_content)[0]
newBody = ""
for i in range(0,self._log.size()):
tmp = templateBody
tmp = tmp.replace("$vulnerability", self.htmlEscape(self._log.get(i).getName()))
tmp = tmp.replace("$severity", self.htmlEscape(self._log.get(i).getSeverity()))
tmp = tmp.replace("$description", self.htmlEscape(self._log.get(i).getDescription()))
tmp = tmp.replace("$mitigation", self.htmlEscape(self._log.get(i).getMitigation()))
newBody = newBody + tmp
newXML = newXML + newBody
newXML = newXML + result[1]
with zipfile.ZipFile(newZipName, mode='a', compression=zipfile.ZIP_DEFLATED) as zf:
zf.writestr(filename, newXML)
return newZipName
def chooseProjPath(self, event):
self.chooser.setDialogTitle("Select target directory")
self.chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY)
returnVal = self.chooser.showOpenDialog(None)
if returnVal == JFileChooser.APPROVE_OPTION:
projPath = str(self.chooser.getSelectedFile()) + "/PTManager"
os.makedirs(projPath)
self.projPath.setText(projPath)
def reloadProjects(self):
self.currentProject.setModel(DefaultComboBoxModel(self.config.options('projects')))
def rmProj(self, event):
if self.popUpAreYouSure() == JOptionPane.YES_OPTION:
self._requestViewer.setMessage("None", False)
self._responseViewer.setMessage("None", False)
shutil.rmtree(self.projPath.getText())
self.config.remove_option('projects',self.currentProject.getSelectedItem())
self.reloadProjects()
self.currentProject.setSelectedIndex(0)
self.loadVulnerabilities(self.projPath.getText())
def popup(self,msg):
JOptionPane.showMessageDialog(None,msg)
def addProj(self, event):
projPath = self.projPath.getText()
if projPath == None or projPath == "":
self.popup("Please select path")
return
self.config.set('projects', self.projName.getText(), projPath)
self.saveCfg()
xml = ET.Element('project')
name = ET.SubElement(xml, "name")
path = ET.SubElement(xml, "path")
details = ET.SubElement(xml, "details")
autoSaveMode = ET.SubElement(xml, "autoSaveMode")
name.text = self.projName.getText()
path.text = projPath
details.text = self.projDetails.getText()
autoSaveMode.text = str(self.autoSave.isSelected())
tree = ET.ElementTree(xml)