本文整理汇总了Python中javax.swing.JCheckBox.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python JCheckBox.setEnabled方法的具体用法?Python JCheckBox.setEnabled怎么用?Python JCheckBox.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JCheckBox
的用法示例。
在下文中一共展示了JCheckBox.setEnabled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _initializeGui
# 需要导入模块: from javax.swing import JCheckBox [as 别名]
# 或者: from javax.swing.JCheckBox import setEnabled [as 别名]
def _initializeGui(self, callbacks):
tab = JPanel()
jLabel1 = JLabel("Original Hash:")
jLabel2 = JLabel("Original message:")
jLabel3 = JLabel("Message to append:")
jLabel5 = JLabel("Max key length:")
jTextField1 = JTextField("")
jTextField2 = JTextField("")
jTextField3 = JTextField("")
jTextField4 = JTextField("128")
jLabel4 = JLabel("Hashing functions")
jCheckBox1 = JCheckBox("MD4")
jCheckBox2 = JCheckBox("MD5")
jCheckBox3 = JCheckBox("SHA1")
jCheckBox4 = JCheckBox("SHA256")
jCheckBox5 = JCheckBox("SHA512")
jCheckBox1.setEnabled(False)
jCheckBox2.setEnabled(False)
jCheckBox3.setEnabled(False)
jCheckBox4.setEnabled(False)
jCheckBox5.setEnabled(False)
jScrollPane1 = JScrollPane()
jTable1 = JTable()
jButton1 = JButton("Generate", actionPerformed=self.generate_attack)
jButton1.setEnabled(False)
jButton2 = JButton("Copy messages", actionPerformed=self.copy_messages)
jButton3 = JButton("Copy hashes", actionPerformed=self.copy_hashes)
self._tab = tab
self._textfields = {
"original_hash": jTextField1,
"original_msg": jTextField2,
"append_msg": jTextField3,
"max_key_len": jTextField4,
}
self._checkboxes = {
md4: jCheckBox1,
md5: jCheckBox2,
sha1: jCheckBox3,
sha256: jCheckBox4,
sha512: jCheckBox5,
}
self._table = jTable1
self._extensions = {}
self._hashes, self._messages = [], []
# Hash field change event
jTextField1.getDocument().addDocumentListener(HashChangeListener(self._checkboxes, self._textfields['original_hash'], jButton1))
# Table columns
jTable1.setModel(DefaultTableModel([],["#", "Type","New Message", "Hash"]))
jScrollPane1.setViewportView(jTable1)
# Table column width
jTable1.getColumnModel().getColumn(0).setMaxWidth(50)
jTable1.getColumnModel().getColumn(1).setMaxWidth(60)
layout = GroupLayout(tab)
tab.setLayout(layout)
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(jTextField3, GroupLayout.DEFAULT_SIZE, 425, 32767)
.addComponent(jTextField2)
.addComponent(jTextField1)
.addGroup(layout.createSequentialGroup()
.addComponent(jTextField4, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 32767)))
.addGap(30, 30, 30)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jCheckBox1)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jCheckBox2)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jCheckBox3)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jCheckBox4)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jCheckBox5))
.addComponent(jLabel4)
.addGroup(layout.createSequentialGroup()
.addComponent(jButton1)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2)))
.addGap(167, 167, 167))
.addComponent(jScrollPane1)
)
#.........这里部分代码省略.........
示例2: defineCheckBox
# 需要导入模块: from javax.swing import JCheckBox [as 别名]
# 或者: from javax.swing.JCheckBox import setEnabled [as 别名]
def defineCheckBox(self, caption, selected=True, enabled=True):
checkBox = JCheckBox(caption)
checkBox.setSelected(selected)
checkBox.setEnabled(enabled)
return checkBox
示例3: __init__
# 需要导入模块: from javax.swing import JCheckBox [as 别名]
# 或者: from javax.swing.JCheckBox import setEnabled [as 别名]
def __init__(self, instructionsURI=''):
self.instructionsURI = instructionsURI
self.logger = logging.getLogger('sasi_runner_gui')
self.logger.addHandler(logging.StreamHandler())
def log_fn(msg):
self.log_msg(msg)
self.logger.addHandler(FnLogHandler(log_fn))
self.logger.setLevel(logging.DEBUG)
self.selected_input_file = None
self.selected_output_file = None
self.frame = JFrame(
"SASI Runner",
defaultCloseOperation = WindowConstants.EXIT_ON_CLOSE,
)
self.frame.size = (650, 600,)
self.main_panel = JPanel()
self.main_panel.layout = BoxLayout(self.main_panel, BoxLayout.Y_AXIS)
self.frame.add(self.main_panel)
self.top_panel = JPanel(SpringLayout())
self.top_panel.alignmentX = Component.CENTER_ALIGNMENT
self.main_panel.add(self.top_panel)
self.stageCounter = 1
def getStageLabel(txt):
label = JLabel("%s. %s" % (self.stageCounter, txt))
self.stageCounter += 1
return label
# Instructions link.
self.top_panel.add(getStageLabel("Read the instructions:"))
instructionsButton = JButton(
('<HTML><FONT color="#000099">'
'<U>open instructions</U></FONT><HTML>'),
actionPerformed=self.browseInstructions)
instructionsButton.setHorizontalAlignment(SwingConstants.LEFT);
instructionsButton.setBorderPainted(False);
instructionsButton.setOpaque(False);
instructionsButton.setBackground(Color.WHITE);
instructionsButton.setToolTipText(self.instructionsURI);
self.top_panel.add(instructionsButton)
# 'Select input' elements.
self.top_panel.add(getStageLabel(
"Select a SASI .zip file or data folder:"))
self.top_panel.add(
JButton("Select input...", actionPerformed=self.openInputChooser))
# 'Select output' elements.
self.top_panel.add(getStageLabel("Specify an output file:"))
self.top_panel.add(
JButton("Specify output...", actionPerformed=self.openOutputChooser))
# 'Set result fields' elements.
result_fields = [
{'id': 'gear_id', 'label': 'Gear', 'selected': True,
'enabled': False},
{'id': 'substrate_id', 'label': 'Substrate', 'selected': True},
{'id': 'energy_id', 'label': 'Energy', 'selected': False},
{'id': 'feature_id', 'label': 'Feature', 'selected': False},
{'id': 'feature_category_id', 'label': 'Feature Category',
'selected': False}
]
self.selected_result_fields = {}
resolutionLabelPanel = JPanel(GridLayout(0,1))
resolutionLabelPanel.add(getStageLabel("Set result resolution:"))
resolutionLabelPanel.add(
JLabel(("<html><i>This sets the specificity with which<br>"
"results will be grouped. Note that enabling<br>"
"more fields can *greatly* increase resulting<br>"
"output sizes and run times.</i>")))
#self.top_panel.add(getStageLabel("Set result resolution:"))
self.top_panel.add(resolutionLabelPanel)
checkPanel = JPanel(GridLayout(0, 1))
self.top_panel.add(checkPanel)
self.resultFieldCheckBoxes = {}
for result_field in result_fields:
self.selected_result_fields.setdefault(
result_field['id'], result_field['selected'])
checkBox = JCheckBox(
result_field['label'], result_field['selected'])
checkBox.setEnabled(result_field.get('enabled', True))
checkBox.addItemListener(self)
checkPanel.add(checkBox)
self.resultFieldCheckBoxes[checkBox] = result_field
# 'Run' elements.
self.top_panel.add(getStageLabel("Run SASI: (this might take a while)"))
self.run_button = JButton("Run...", actionPerformed=self.runSASI)
self.top_panel.add(self.run_button)
SpringUtilities.makeCompactGrid(
self.top_panel, self.stageCounter - 1, 2, 6, 6, 6, 6)
# Progress bar.
self.progressBar = JProgressBar(0, 100)
#.........这里部分代码省略.........
示例4: BurpExtender
# 需要导入模块: from javax.swing import JCheckBox [as 别名]
# 或者: from javax.swing.JCheckBox import setEnabled [as 别名]
#.........这里部分代码省略.........
self.projDetails.setLineWrap(True)
projDetailsScroll = JScrollPane(self.projDetails)
projDetailsScroll.setBounds(10, 150, 450, 175)
projDetailsScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED)
projPathLabel = JLabel("Path:")
projPathLabel.setBounds(10, 90, 140, 30)
self.projPath = JTextField("")
self.projPath.setBounds(140, 90, 320, 30)
chooseProjPathButton = JButton("Browse...",actionPerformed=self.chooseProjPath)
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)