本文整理汇总了Python中javax.swing.JComboBox.getModel方法的典型用法代码示例。如果您正苦于以下问题:Python JComboBox.getModel方法的具体用法?Python JComboBox.getModel怎么用?Python JComboBox.getModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JComboBox
的用法示例。
在下文中一共展示了JComboBox.getModel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SessionRequestTab
# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import getModel [as 别名]
#.........这里部分代码省略.........
action = str(table_model.getValueAt(r, 1))
name = table_model.getValueAt(r, 2)
value = table_model.getValueAt(r, 3)
if type != None and name != None and value != None:
param = Parameter(type, action, name, self._extender.helpers.urlDecode(value))
session.modify(param)
# Check if there is an empty last row
has_empty_row = True
for i in range(2, 4):
val = table_model.getValueAt(table_model.getRowCount() - 1, i)
if val != None and val != "":
has_empty_row = False
break
# no empty last row, add one
if not has_empty_row:
table_model.addRow(["", Parameter.ACTION_MODIFY, "", ""])
# update message editor
self.parse_message()
def parse_message(self):
self._editor.setText(self._extender.process_request(self._extender.HTTP))
def getTabCaption(self):
return "Session"
def getUiComponent(self):
return self._panel
def isEnabled(self, content, isRequest):
return isRequest
def setMessage(self, content, isRequest):
self._extender.HTTP = self._extender.helpers.bytesToString(content)
self._editor.setText(content)
self.refresh_sessions()
self.update_table()
def getMessage(self):
return self._editor.getText()
def isModified(self):
return self._editor.isTextModified()
def getSelectedData(self):
return self._editor.getSelectedText()
@attach_stack_trace
def __init__(self, extender, controller, editable):
self._extender = extender
self._panel = JPanel() # main panel
# type combobox for tables
self._types = Parameter.type_mapping.values() + ["- Remove Row -"]
self._actions = ["replace", "insert", "delete"]
# define the GridBagLayout ( 4x4 )
gridBagLayout = GridBagLayout()
gridBagLayout.columnWidths = [ 0, 0, 0, 0]
gridBagLayout.rowHeights = [0, 0, 0, 0]
gridBagLayout.columnWeights = [1.0, 0.0, 0.0, 0.0]
gridBagLayout.rowWeights = [0.0, 1.0, 5.0, 0.0]
self._panel.setLayout(gridBagLayout)
# JComboBox for Session selection
self._session_selector = JComboBox(extender.sm.sessions, itemStateChanged=self.changeSession)
self._session_selector_model = self._session_selector.getModel()
gbc_session_selector = _new_grid_bag(0, 0)
self._panel.add(self._session_selector, gbc_session_selector)
# "Delete Session" Button
del_session = JButton("Delete Session", actionPerformed=self.deleteSession)
gbc_del_session = _new_grid_bag(1, 0)
self._panel.add(del_session, gbc_del_session)
# "New Session" Button
new_session = JButton("New Session", actionPerformed=self.new_session)
gbc_new_session = _new_grid_bag(2, 0)
self._panel.add(new_session, gbc_new_session)
# Table containing modified parameters
self.modification_table = JTable()
self.update_table()
gbc_modification_table = _new_grid_bag(0, 1, 3)
self._panel.add(JScrollPane(self.modification_table), gbc_modification_table)
self.modification_table.setPreferredScrollableViewportSize(self.modification_table.getPreferredSize());
self.modification_table.setFillsViewportHeight(True)
# HTTP message editor
self._editor = self._extender.callbacks.createTextEditor()
gbc_messageEditor = _new_grid_bag(0, 2, 3)
self._panel.add(self._editor.getComponent(), gbc_messageEditor)
示例2: BurpExtender
# 需要导入模块: from javax.swing import JComboBox [as 别名]
# 或者: from javax.swing.JComboBox import getModel [as 别名]
#.........这里部分代码省略.........
chooseProjPathButton.setBounds(470, 90, 100, 30)
importProjButton = JButton("Import",actionPerformed=self.importProj)
importProjButton.setBounds(470, 10, 100, 30)
exportProjButton = JButton("Export",actionPerformed=self.exportProj)
exportProjButton.setBounds(575, 10, 100, 30)
openProjButton = JButton("Open Directory",actionPerformed=self.openProj)
openProjButton.setBounds(680, 10, 130, 30)
currentProjectLabel = JLabel("Current:")
currentProjectLabel.setBounds(10, 10, 140, 30)
projects = self.config.options('projects')
self.currentProject = JComboBox(projects)
self.currentProject.addActionListener(projectChangeHandler(self))
self.currentProject.setBounds(140, 10, 140, 30)
self.autoSave = JCheckBox("Auto Save Mode")
self.autoSave.setEnabled(False) # implement this feature
self.autoSave.setBounds(300, 10, 140, 30)
self.autoSave.setToolTipText("Will save any changed value while focus is out")
addProjButton = JButton("Add / Update",actionPerformed=self.addProj)
addProjButton.setBounds(10, 330, 150, 30)
removeProjButton = JButton("Remove Current",actionPerformed=self.rmProj)
removeProjButton.setBounds(315, 330, 146, 30)
generalOptions = self.config.options('general')
if 'default project' in generalOptions:
defaultProj = self.config.get('general','default project')
self.currentProject.getModel().setSelectedItem(defaultProj)
self.projPath.setText(self.config.get('projects',self.currentProject.getSelectedItem()))
self.clearProjTab = True
self.projectSettings = JPanel()
self.projectSettings.setBounds(0, 0, 1000, 1000)
self.projectSettings.setLayout(None)
self.projectSettings.add(reportLabel)
self.projectSettings.add(detailsLabel)
self.projectSettings.add(projPathLabel)
self.projectSettings.add(addProjButton)
self.projectSettings.add(openProjButton)
self.projectSettings.add(projNameLabel)
self.projectSettings.add(projDetailsScroll)
self.projectSettings.add(importProjButton)
self.projectSettings.add(exportProjButton)
self.projectSettings.add(removeProjButton)
self.projectSettings.add(generateReportButton)
self.projectSettings.add(chooseProjPathButton)
self.projectSettings.add(currentProjectLabel)
self.projectSettings.add(self.projPath)
self.projectSettings.add(self.autoSave)
self.projectSettings.add(self.projName)
self.projectSettings.add(self.reportType)
self.projectSettings.add(self.currentProject)
def initTabs(self):
#
## init autorize tabs
#
self._splitpane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT)
self.scrollPane = JScrollPane(self.logTable)