本文整理汇总了Python中javax.swing.JCheckBox.addActionListener方法的典型用法代码示例。如果您正苦于以下问题:Python JCheckBox.addActionListener方法的具体用法?Python JCheckBox.addActionListener怎么用?Python JCheckBox.addActionListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JCheckBox
的用法示例。
在下文中一共展示了JCheckBox.addActionListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ConfigurableConfigPanel
# 需要导入模块: from javax.swing import JCheckBox [as 别名]
# 或者: from javax.swing.JCheckBox import addActionListener [as 别名]
class ConfigurableConfigPanel(ConfigPanel, ActionListener, DocumentListener, ChangeListener):
""" generated source for class ConfigurableConfigPanel """
serialVersionUID = 1L
associatedFile = File()
associatedFileField = JTextField()
params = JSONObject()
savedParams = str()
loadButton = JButton()
saveAsButton = JButton()
saveButton = JButton()
name = JTextField()
strategy = JComboBox()
metagameStrategy = JComboBox()
stateMachine = JComboBox()
cacheStateMachine = JCheckBox()
maxPlys = JSpinner()
heuristicFocus = JSpinner()
heuristicMobility = JSpinner()
heuristicOpponentFocus = JSpinner()
heuristicOpponentMobility = JSpinner()
mcDecayRate = JSpinner()
rightPanel = JPanel()
def __init__(self):
""" generated source for method __init__ """
super(ConfigurableConfigPanel, self).__init__(GridBagLayout())
leftPanel = JPanel(GridBagLayout())
leftPanel.setBorder(TitledBorder("Major Parameters"))
self.rightPanel = JPanel(GridBagLayout())
self.rightPanel.setBorder(TitledBorder("Minor Parameters"))
self.strategy = JComboBox([None]*)
self.metagameStrategy = JComboBox([None]*)
self.stateMachine = JComboBox([None]*)
self.cacheStateMachine = JCheckBox()
self.maxPlys = JSpinner(SpinnerNumberModel(1, 1, 100, 1))
self.heuristicFocus = JSpinner(SpinnerNumberModel(1, 0, 10, 1))
self.heuristicMobility = JSpinner(SpinnerNumberModel(1, 0, 10, 1))
self.heuristicOpponentFocus = JSpinner(SpinnerNumberModel(1, 0, 10, 1))
self.heuristicOpponentMobility = JSpinner(SpinnerNumberModel(1, 0, 10, 1))
self.mcDecayRate = JSpinner(SpinnerNumberModel(0, 0, 99, 1))
self.name = JTextField()
self.name.setColumns(20)
self.name.setText("Player #" + Random().nextInt(100000))
self.loadButton = JButton(loadButtonMethod())
self.saveButton = JButton(saveButtonMethod())
self.saveAsButton = JButton(saveAsButtonMethod())
self.associatedFileField = JTextField()
self.associatedFileField.setEnabled(False)
buttons = JPanel()
buttons.add(self.loadButton)
buttons.add(self.saveButton)
buttons.add(self.saveAsButton)
nRow = 0
leftPanel.add(JLabel("Name"), GridBagConstraints(0, nRow, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, Insets(5, 5, 5, 5), 5, 5))
__nRow_0 = nRow
nRow += 1
leftPanel.add(self.name, GridBagConstraints(1, __nRow_0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, Insets(5, 5, 5, 5), 5, 5))
leftPanel.add(JLabel("Gaming Strategy"), GridBagConstraints(0, nRow, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, Insets(5, 5, 5, 5), 5, 5))
__nRow_1 = nRow
nRow += 1
leftPanel.add(self.strategy, GridBagConstraints(1, __nRow_1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, Insets(5, 5, 5, 5), 5, 5))
leftPanel.add(JLabel("Metagame Strategy"), GridBagConstraints(0, nRow, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, Insets(5, 5, 5, 5), 5, 5))
__nRow_2 = nRow
nRow += 1
leftPanel.add(self.metagameStrategy, GridBagConstraints(1, __nRow_2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, Insets(5, 5, 5, 5), 5, 5))
leftPanel.add(JLabel("State Machine"), GridBagConstraints(0, nRow, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, Insets(5, 5, 5, 5), 5, 5))
__nRow_3 = nRow
nRow += 1
leftPanel.add(self.stateMachine, GridBagConstraints(1, __nRow_3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, Insets(5, 5, 5, 5), 5, 5))
__nRow_4 = nRow
nRow += 1
leftPanel.add(buttons, GridBagConstraints(1, __nRow_4, 2, 1, 1.0, 1.0, GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, Insets(5, 5, 0, 5), 0, 0))
leftPanel.add(self.associatedFileField, GridBagConstraints(0, nRow, 2, 1, 1.0, 0.0, GridBagConstraints.SOUTHEAST, GridBagConstraints.HORIZONTAL, Insets(0, 5, 5, 5), 0, 0))
layoutRightPanel()
add(leftPanel, GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, Insets(5, 5, 5, 5), 5, 5))
add(self.rightPanel, GridBagConstraints(1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, Insets(5, 5, 5, 5), 5, 5))
self.params = JSONObject()
syncJSONtoUI()
self.strategy.addActionListener(self)
self.metagameStrategy.addActionListener(self)
self.stateMachine.addActionListener(self)
self.cacheStateMachine.addActionListener(self)
self.maxPlys.addChangeListener(self)
self.heuristicFocus.addChangeListener(self)
self.heuristicMobility.addChangeListener(self)
self.heuristicOpponentFocus.addChangeListener(self)
self.heuristicOpponentMobility.addChangeListener(self)
self.mcDecayRate.addChangeListener(self)
self.name.getDocument().addDocumentListener(self)
def layoutRightPanel(self):
""" generated source for method layoutRightPanel """
nRow = 0
self.rightPanel.removeAll()
self.rightPanel.add(JLabel("State machine cache?"), GridBagConstraints(0, nRow, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, Insets(5, 5, 5, 5), 5, 5))
__nRow_5 = nRow
nRow += 1
self.rightPanel.add(self.cacheStateMachine, GridBagConstraints(1, __nRow_5, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, Insets(5, 5, 5, 5), 5, 5))
if self.strategy.getSelectedItem().__str__() == "Heuristic":
__nRow_6 = nRow
#.........这里部分代码省略.........
示例2: SystemPanel
# 需要导入模块: from javax.swing import JCheckBox [as 别名]
# 或者: from javax.swing.JCheckBox import addActionListener [as 别名]
class SystemPanel(JPanel, ActionListener, ItemListener, PropertyChangeListener):
def propertyChange(self, evt):
if evt.getSource() == self.fdr and evt.getPropertyName() == 'value':
new = float(evt.getNewValue())
old = float(evt.getOldValue())
if new > 0.99:
evt.getSource().setValue(old)
if new < 0.005:
evt.getSource().setValue(old)
def itemStateChanged(self, e):
if self.enableChartFun:
self.chartFun()
def actionPerformed(self, e):
if e.getID() <> ActionEvent.ACTION_PERFORMED:
return
if e.getSource() == self.neutral:
if self.isTemporal:
warn(self, """
Using a "neutral" mean Ne means doing a first simulation run to
remove potential selected loci for computing the initial mean Ne.
This effectively doubles the computation time, but it is the recommended
option.
If you are not sure of what you want, please check this option.
""")
else:
warn(self, """
Using a "neutral" mean Fst means doing a first simulation run to
remove potential selected loci for computing the initial mean Fst.
This effectively doubles the computation time, but it is the recommended
option.
If you are not sure of what you want, please check this option.
""")
elif e.getSource() == self.force:
warn(self, """
Simulating a PRECISE mean Fst is not possible outside ideal theoretical
conditions (infinite populations, infinite allele model). SELWB can try to
approximate a desired Fst, by running a bisection algorithm over repeated
simulations.
Checking this option will increase the computation time by a certain amount
of time (in most cases it will double the computation time), this is still,
the recommended option.
If you are not sure of what you want, please check this option.
""")
def getForce(self):
if self.force.getSelectedObjects() == None:
return False
else:
return True
def getNeutral(self):
if self.neutral.getSelectedObjects() == None:
return False
else:
return True
def getCI(self):
return float(self.ci.getSelectedItem())
def getFDR(self):
return self.fdr.getValue()
def getNumCores(self):
return int(self.cores.getSelectedItem())
def getNumSims(self):
return 1000*int(self.numSims.getSelectedItem())
def __init__(self, chartFun, isTemporal = False):
self.isTemporal = isTemporal
JPanel()
#self.setBackground(Color.LIGHT_GRAY)
self.chartFun = chartFun
self.enableChartFun = False
self.setLayout(GridLayout(6,2))
self.add(JLabel('CPU Cores'))
cores = JComboBox(['1', '2', '4', '8', '16', '32', '64', '128'])
nprocs = ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors()
pos = min([7, log(ceil(nprocs)) / log(2)])
cores.setSelectedIndex(int(pos))
cores.setMaximumSize(cores.getPreferredSize())
self.cores = cores
self.add(self.cores)
self.add(JLabel('# of sims (x1000) '))
numSims = JComboBox(
map(lambda x: str((10+x)*5), range(10)) +
map(lambda x: str(x*100), range(1,11))
)
numSims.setMaximumSize(numSims.getPreferredSize())
self.numSims = numSims
self.add(self.numSims)
if isTemporal:
self.add(JLabel('"Neutral" Ne'))
self.neutral = JCheckBox()
self.neutral.addActionListener(self)
self.add(self.neutral)
#.........这里部分代码省略.........