本文整理汇总了Python中javax.swing.JTextField.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python JTextField.setEnabled方法的具体用法?Python JTextField.setEnabled怎么用?Python JTextField.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextField
的用法示例。
在下文中一共展示了JTextField.setEnabled方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: NewZoneDialog
# 需要导入模块: from javax.swing import JTextField [as 别名]
# 或者: from javax.swing.JTextField import setEnabled [as 别名]
#.........这里部分代码省略.........
self.add(Box.createRigidArea(Dimension(0, 15)))
modeLbl.setAlignmentX(Component.LEFT_ALIGNMENT)
self.add(modeLbl)
self.add(Box.createRigidArea(Dimension(0, 5)))
self.add(self.modesComboBox)
self.modesComboBox.setAlignmentX(Component.LEFT_ALIGNMENT)
self.add(Box.createRigidArea(Dimension(0, 15)))
self.configPanel = JPanel(CardLayout())
self.configPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5))
self.configPanel.add(self.rectPanel, RECTPANEL)
self.configPanel.add(self.polygonPanel, POLYGONPANEL)
self.configPanel.add(self.boundaryPanel, BOUNDARYPANEL)
self.configPanel.setAlignmentX(Component.LEFT_ALIGNMENT)
self.add(self.configPanel)
buttonsPanel = JPanel()
buttonsPanel.add(self.okBtn)
buttonsPanel.add(self.cancelBtn)
buttonsPanel.add(self.previewBtn)
buttonsPanel.setAlignmentX(Component.LEFT_ALIGNMENT)
self.add(buttonsPanel)
self.addWindowListener(self)
self.pack()
def update_gui_from_preferences(self):
self.nameTextField.setText(self.app.newZone.name)
#Reset rectangle mode
bboxStr = ",".join(["%0.4f" % x for x in self.app.newZone.bbox])
self.bboxTextField.setText(bboxStr)
self.bboxPreviewTextField.setText(bboxStr)
self.bboxFromJosmBtn.setEnabled(True)
self.bboxTextField.setEnabled(False)
#Reset polygon mode
self.polygonAsString = ""
#Reset boundary mode
self.boundaryAsString = ""
self.modesComboBox.setSelectedIndex(0)
def actionPerformed(self, e):
#Show the panel for configuring the favourite area of the
#selected type
if e.getSource() == self.modesComboBox:
cl = self.configPanel.getLayout()
selectedMode = self.modesStrings[self.modesComboBox.selectedIndex]
cl.show(self.configPanel, selectedMode)
#Activate bbox input for rectangular favourite zone mode
elif e.getSource() == self.captureRBtn:
self.bboxFromJosmBtn.setEnabled(True)
self.bboxTextField.setEnabled(False)
else:
self.bboxFromJosmBtn.setEnabled(False)
self.bboxTextField.setEnabled(True)
def on_bboxFromJosmBtn_clicked(self, widget):
"""Read bbox currently shown in JOSM
"""
bbox = self.app.get_frame_bounds()
self.bboxPreviewTextField.setText(",".join(["%0.4f" % x for x in bbox]))
### Manage layer for creating a new favourite zone from polygon or boundary
示例2: VolatilitySettingsWithUISettingsPanel
# 需要导入模块: from javax.swing import JTextField [as 别名]
# 或者: from javax.swing.JTextField import setEnabled [as 别名]
#.........这里部分代码省略.........
self.local_settings.setSetting('AdditionalParms', self.Additional_Parms_TF.getText())
#self.Error_Message.setText(self.Additional_Parms_TF.getText())
def onchange_version(self, event):
self.local_settings.setSetting('Version', event.item)
plugin_list = self.get_plugins()
profile_list = self.get_profiles()
self.Profile_CB.removeAllItems()
self.Plugin_LB.clearSelection()
self.Plugin_LB.setListData(plugin_list)
for profile in profile_list:
self.Profile_CB.addItem(profile)
#self.Profile_CB.addItems(profile)
self.panel0.repaint()
def onchange_plugins_lb(self, event):
self.local_settings.setSetting('PluginListBox' , '')
list_selected = self.Plugin_LB.getSelectedValuesList()
self.local_settings.setSetting('PluginListBox', str(list_selected))
def onchange_profile_cb(self, event):
self.local_settings.setSetting('Profile', event.item)
# Create the initial data fields/layout in the UI
def initComponents(self):
self.panel0 = JPanel()
self.rbgPanel0 = ButtonGroup()
self.gbPanel0 = GridBagLayout()
self.gbcPanel0 = GridBagConstraints()
self.panel0.setLayout( self.gbPanel0 )
self.Error_Message = JLabel( "")
self.Error_Message.setEnabled(True)
self.gbcPanel0.gridx = 2
self.gbcPanel0.gridy = 31
self.gbcPanel0.gridwidth = 1
self.gbcPanel0.gridheight = 1
self.gbcPanel0.fill = GridBagConstraints.BOTH
self.gbcPanel0.weightx = 1
self.gbcPanel0.weighty = 0
self.gbcPanel0.anchor = GridBagConstraints.NORTH
self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 )
self.panel0.add( self.Error_Message )
self.Label_1 = JLabel("Volatility Executable Directory")
self.Label_1.setEnabled(True)
self.gbcPanel0.gridx = 2
self.gbcPanel0.gridy = 1
self.gbcPanel0.gridwidth = 1
self.gbcPanel0.gridheight = 1
self.gbcPanel0.fill = GridBagConstraints.BOTH
self.gbcPanel0.weightx = 1
self.gbcPanel0.weighty = 0
self.gbcPanel0.anchor = GridBagConstraints.NORTH
self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 )
self.panel0.add( self.Label_1 )
self.Program_Executable_TF = JTextField(10)
self.Program_Executable_TF.setEnabled(True)
self.gbcPanel0.gridx = 2
self.gbcPanel0.gridy = 3
self.gbcPanel0.gridwidth = 1
self.gbcPanel0.gridheight = 1
self.gbcPanel0.fill = GridBagConstraints.BOTH
self.gbcPanel0.weightx = 1
示例3: GUI_TestWithUISettingsPanel
# 需要导入模块: from javax.swing import JTextField [as 别名]
# 或者: from javax.swing.JTextField import setEnabled [as 别名]
class GUI_TestWithUISettingsPanel(IngestModuleIngestJobSettingsPanel):
# Note, we can't use a self.settings instance variable.
# Rather, self.local_settings is used.
# https://wiki.python.org/jython/UserGuide#javabean-properties
# Jython Introspector generates a property - 'settings' on the basis
# of getSettings() defined in this class. Since only getter function
# is present, it creates a read-only 'settings' property. This auto-
# generated read-only property overshadows the instance-variable -
# 'settings'
# We get passed in a previous version of the settings so that we can
# prepopulate the UI
# TODO: Update this for your UI
def __init__(self, settings):
self.local_settings = settings
self.initComponents()
self.customizeComponents()
# TODO: Update this for your UI
def checkBoxEvent(self, event):
if self.Exec_Program_CB.isSelected():
self.local_settings.setSetting('Exec_Prog_Flag', 'true')
self.Program_Executable_TF.setEnabled(True)
self.Find_Program_Exec_BTN.setEnabled(True)
else:
self.local_settings.setSetting('Exec_Prog_Flag', 'false')
self.Program_Executable_TF.setText("")
self.Program_Executable_TF.setEnabled(False)
self.Find_Program_Exec_BTN.setEnabled(False)
if self.Imp_File_CB.isSelected():
self.local_settings.setSetting('Imp_File_Flag', 'true')
self.File_Imp_TF.setEnabled(True)
self.Find_Imp_File_BTN.setEnabled(True)
else:
self.local_settings.setSetting('Imp_File_Flag', 'false')
self.File_Imp_TF.setText("")
self.local_settings.setSetting('File_Imp_TF', "")
self.File_Imp_TF.setEnabled(False)
self.Find_Imp_File_BTN.setEnabled(False)
def keyPressed(self, event):
self.local_settings.setSetting('Area', self.area.getText())
def onchange_cb(self, event):
self.local_settings.setSetting('ComboBox', event.item)
#self.Error_Message.setText(event.item)
def onchange_lb(self, event):
self.local_settings.setSetting('ListBox', "")
list_selected = self.List_Box_LB.getSelectedValuesList()
self.local_settings.setSetting('ListBox', str(list_selected))
# if (len(list_selected) > 0):
# self.Error_Message.setText(str(list_selected))
# else:
# self.Error_Message.setText("")
def onClick(self, e):
chooseFile = JFileChooser()
filter = FileNameExtensionFilter("SQLite", ["sqlite"])
chooseFile.addChoosableFileFilter(filter)
ret = chooseFile.showDialog(self.panel0, "Select SQLite")
if ret == JFileChooser.APPROVE_OPTION:
file = chooseFile.getSelectedFile()
Canonical_file = file.getCanonicalPath()
#text = self.readPath(file)
if self.File_Imp_TF.isEnabled():
self.File_Imp_TF.setText(Canonical_file)
self.local_settings.setSetting('File_Imp_TF', Canonical_file)
else:
self.local_settings.setSetting('ExecFile', Canonical_file)
self.Program_Executable_TF.setText(Canonical_file)
# TODO: Update this for your UI
def initComponents(self):
self.panel0 = JPanel()
self.rbgPanel0 = ButtonGroup()
self.gbPanel0 = GridBagLayout()
self.gbcPanel0 = GridBagConstraints()
self.panel0.setLayout( self.gbPanel0 )
self.Exec_Program_CB = JCheckBox("Execute Program", actionPerformed=self.checkBoxEvent)
self.gbcPanel0.gridx = 2
self.gbcPanel0.gridy = 1
self.gbcPanel0.gridwidth = 1
self.gbcPanel0.gridheight = 1
self.gbcPanel0.fill = GridBagConstraints.BOTH
self.gbcPanel0.weightx = 1
self.gbcPanel0.weighty = 0
self.gbcPanel0.anchor = GridBagConstraints.NORTH
self.gbPanel0.setConstraints( self.Exec_Program_CB, self.gbcPanel0 )
self.panel0.add( self.Exec_Program_CB )
self.Program_Executable_TF = JTextField(20)
self.Program_Executable_TF.setEnabled(False)
self.gbcPanel0.gridx = 2
#.........这里部分代码省略.........
示例4: GUI_Test_SQLSettingsWithUISettingsPanel
# 需要导入模块: from javax.swing import JTextField [as 别名]
# 或者: from javax.swing.JTextField import setEnabled [as 别名]
class GUI_Test_SQLSettingsWithUISettingsPanel(IngestModuleIngestJobSettingsPanel):
# Note, we can't use a self.settings instance variable.
# Rather, self.local_settings is used.
# https://wiki.python.org/jython/UserGuide#javabean-properties
# Jython Introspector generates a property - 'settings' on the basis
# of getSettings() defined in this class. Since only getter function
# is present, it creates a read-only 'settings' property. This auto-
# generated read-only property overshadows the instance-variable -
# 'settings'
# We get passed in a previous version of the settings so that we can
# prepopulate the UI
# TODO: Update this for your UI
def __init__(self, settings):
self.local_settings = settings
self.initComponents()
self.customizeComponents()
# Check the checkboxs to see what actions need to be taken
def checkBoxEvent(self, event):
if self.Exec_Program_CB.isSelected():
self.local_settings.setSetting('Exec_Prog_Flag', 'true')
self.Program_Executable_TF.setEnabled(True)
self.Find_Program_Exec_BTN.setEnabled(True)
else:
self.local_settings.setSetting('Exec_Prog_Flag', 'false')
self.Program_Executable_TF.setText("")
self.Program_Executable_TF.setEnabled(False)
self.Find_Program_Exec_BTN.setEnabled(False)
# Check to see if there are any entries that need to be populated from the database.
def check_Database_entries(self):
head, tail = os.path.split(os.path.abspath(__file__))
settings_db = os.path.join(head, "GUI_Settings.db3")
try:
Class.forName("org.sqlite.JDBC").newInstance()
dbConn = DriverManager.getConnection("jdbc:sqlite:%s" % settings_db)
except SQLException as e:
self.Error_Message.setText("Error Opening Settings DB!")
try:
stmt = dbConn.createStatement()
SQL_Statement = 'Select Setting_Name, Setting_Value from settings;'
resultSet = stmt.executeQuery(SQL_Statement)
while resultSet.next():
if resultSet.getString("Setting_Name") == "Program_Exec_Name":
self.Program_Executable_TF.setText(resultSet.getString("Setting_Value"))
self.local_settings.setSetting('ExecFile', resultSet.getString("Setting_Value"))
self.local_settings.setSetting('Exec_Prog_Flag', 'true')
self.Exec_Program_CB.setSelected(True)
self.Program_Executable_TF.setEnabled(True)
self.Find_Program_Exec_BTN.setEnabled(True)
self.Error_Message.setText("Settings Read successfully!")
except SQLException as e:
self.Error_Message.setText("Error Reading Settings Database")
stmt.close()
dbConn.close()
# Save entries from the GUI to the database.
def SaveSettings(self, e):
head, tail = os.path.split(os.path.abspath(__file__))
settings_db = os.path.join(head, "GUI_Settings.db3")
try:
Class.forName("org.sqlite.JDBC").newInstance()
dbConn = DriverManager.getConnection("jdbc:sqlite:%s" % settings_db)
except SQLException as e:
self.Error_Message.setText("Error Opening Settings")
try:
stmt = dbConn.createStatement()
SQL_Statement = 'Insert into settings (Setting_Name, Setting_Value) values ("Program_Exec_Name", "' + \
self.Program_Executable_TF.getText() + '");'
resultSet = stmt.executeQuery(SQL_Statement)
self.Error_Message.setText("Settings Saved")
except SQLException as e:
self.Error_Message.setText("Error Inserting Settings " + str(e))
stmt.close()
dbConn.close()
# When button to find file is clicked then open dialog to find the file and return it.
def onClick(self, e):
chooseFile = JFileChooser()
filter = FileNameExtensionFilter("SQLite", ["sqlite"])
chooseFile.addChoosableFileFilter(filter)
ret = chooseFile.showDialog(self.panel0, "Select SQLite")
if ret == JFileChooser.APPROVE_OPTION:
file = chooseFile.getSelectedFile()
Canonical_file = file.getCanonicalPath()
#text = self.readPath(file)
self.local_settings.setSetting('ExecFile', Canonical_file)
self.Program_Executable_TF.setText(Canonical_file)
# Create the initial data fields/layout in the UI
def initComponents(self):
#.........这里部分代码省略.........
示例5: VolatilitySettingsWithUISettingsPanel
# 需要导入模块: from javax.swing import JTextField [as 别名]
# 或者: from javax.swing.JTextField import setEnabled [as 别名]
class VolatilitySettingsWithUISettingsPanel(IngestModuleIngestJobSettingsPanel):
# Note, we can't use a self.settings instance variable.
# Rather, self.local_settings is used.
# https://wiki.python.org/jython/UserGuide#javabean-properties
# Jython Introspector generates a property - 'settings' on the basis
# of getSettings() defined in this class. Since only getter function
# is present, it creates a read-only 'settings' property. This auto-
# generated read-only property overshadows the instance-variable -
# 'settings'
# We get passed in a previous version of the settings so that we can
# prepopulate the UI
# TODO: Update this for your UI
def __init__(self, settings):
self.local_settings = settings
self.initComponents()
self.customizeComponents()
# When button to find file is clicked then open dialog to find the file and return it.
def Find_Dir(self, e):
chooseFile = JFileChooser()
filter = FileNameExtensionFilter("All", ["*.*"])
chooseFile.addChoosableFileFilter(filter)
#chooseFile.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY)
ret = chooseFile.showDialog(self.panel0, "Find Volatility Directory")
if ret == JFileChooser.APPROVE_OPTION:
file = chooseFile.getSelectedFile()
Canonical_file = file.getCanonicalPath()
#text = self.readPath(file)
self.local_settings.setSetting('Volatility_Directory', Canonical_file)
self.Program_Executable_TF.setText(Canonical_file)
def keyPressed(self, event):
self.local_settings.setProcessIDs(self.Process_Ids_To_Dump_TF.getText())
#self.Error_Message.setText(self.Process_Ids_To_Dump_TF.getText())
def checkBoxEvent(self, event):
if self.Check_Box.isSelected():
self.local_settings.setSetting('Flag', 'true')
else:
self.local_settings.setSetting('Flag', 'False')
# Create the initial data fields/layout in the UI
def initComponents(self):
self.panel0 = JPanel()
self.rbgPanel0 = ButtonGroup()
self.gbPanel0 = GridBagLayout()
self.gbcPanel0 = GridBagConstraints()
self.panel0.setLayout( self.gbPanel0 )
self.Error_Message = JLabel( "")
self.Error_Message.setEnabled(True)
self.gbcPanel0.gridx = 2
self.gbcPanel0.gridy = 15
self.gbcPanel0.gridwidth = 1
self.gbcPanel0.gridheight = 1
self.gbcPanel0.fill = GridBagConstraints.BOTH
self.gbcPanel0.weightx = 1
self.gbcPanel0.weighty = 0
self.gbcPanel0.anchor = GridBagConstraints.NORTH
self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 )
self.panel0.add( self.Error_Message )
self.Label_1 = JLabel("Volatility Executable Directory")
self.Label_1.setEnabled(True)
self.gbcPanel0.gridx = 2
self.gbcPanel0.gridy = 1
self.gbcPanel0.gridwidth = 1
self.gbcPanel0.gridheight = 1
self.gbcPanel0.fill = GridBagConstraints.BOTH
self.gbcPanel0.weightx = 1
self.gbcPanel0.weighty = 0
self.gbcPanel0.anchor = GridBagConstraints.NORTH
self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 )
self.panel0.add( self.Label_1 )
self.Program_Executable_TF = JTextField(10)
self.Program_Executable_TF.setEnabled(True)
self.gbcPanel0.gridx = 2
self.gbcPanel0.gridy = 3
self.gbcPanel0.gridwidth = 1
self.gbcPanel0.gridheight = 1
self.gbcPanel0.fill = GridBagConstraints.BOTH
self.gbcPanel0.weightx = 1
self.gbcPanel0.weighty = 0
self.gbcPanel0.anchor = GridBagConstraints.NORTH
self.gbPanel0.setConstraints( self.Program_Executable_TF, self.gbcPanel0 )
self.panel0.add( self.Program_Executable_TF )
self.Find_Program_Exec_BTN = JButton( "Find Dir", actionPerformed=self.Find_Dir)
self.Find_Program_Exec_BTN.setEnabled(True)
self.rbgPanel0.add( self.Find_Program_Exec_BTN )
self.gbcPanel0.gridx = 6
self.gbcPanel0.gridy = 3
self.gbcPanel0.gridwidth = 1
self.gbcPanel0.gridheight = 1
#.........这里部分代码省略.........
示例6: ConfigurableConfigPanel
# 需要导入模块: from javax.swing import JTextField [as 别名]
# 或者: from javax.swing.JTextField import setEnabled [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
#.........这里部分代码省略.........
示例7: TimesketchSettingsWithUISettingsPanel
# 需要导入模块: from javax.swing import JTextField [as 别名]
# 或者: from javax.swing.JTextField import setEnabled [as 别名]
class TimesketchSettingsWithUISettingsPanel(IngestModuleIngestJobSettingsPanel):
# Note, we can't use a self.settings instance variable.
# Rather, self.local_settings is used.
# https://wiki.python.org/jython/UserGuide#javabean-properties
# Jython Introspector generates a property - 'settings' on the basis
# of getSettings() defined in this class. Since only getter function
# is present, it creates a read-only 'settings' property. This auto-
# generated read-only property overshadows the instance-variable -
# 'settings'
# We get passed in a previous version of the settings so that we can
# prepopulate the UI
def __init__(self, settings):
self.local_settings = settings
self.tag_list = []
self.initComponents()
self.customizeComponents()
self.path_to_Timesketch_exe = os.path.join(os.path.dirname(os.path.abspath(__file__)), "Timesketch_api.exe")
# Check to see if the Timesketch server is available and you can talk to it
def Check_Server(self, e):
pipe = Popen([self.path_to_Timesketch_exe, self.Protocol_TF.getText(),self.IP_Address_TF.getText(), self.Port_Number_TF.getText(), "Timesketch_status" ], stdout=PIPE, stderr=PIPE)
out_text = pipe.communicate()[0]
self.Error_Message.setText("Timesketch Status is " + out_text)
#self.log(Level.INFO, "Timesketch Status is ==> " + out_text)
def setIPAddress(self, event):
self.local_settings.setSetting('ipAddress', self.IP_Address_TF.getText())
def setPortNumber(self, event):
self.local_settings.setSetting('portNumber', self.Port_Number_TF.getText())
def setUserName(self, event):
self.local_settings.setSetting('userName', self.userName_TF.getText())
def setPassword(self, event):
self.local_settings.setSetting('password', self.password_TF.getText())
def setsketchName(self, event):
self.local_settings.setSetting('sketchName', self.sketchName_TF.getText())
def setsketchDescription(self, event):
self.local_settings.setSetting('sketchDescription', self.sketchDescription_TF.getText())
# Create the initial data fields/layout in the UI
def initComponents(self):
self.panel0 = JPanel()
self.rbgPanel0 = ButtonGroup()
self.gbPanel0 = GridBagLayout()
self.gbcPanel0 = GridBagConstraints()
self.panel0.setLayout( self.gbPanel0 )
self.Label_2 = JLabel("Timesketch IP Address")
self.Label_2.setEnabled(True)
self.gbcPanel0.gridx = 2
self.gbcPanel0.gridy = 5
self.gbcPanel0.gridwidth = 1
self.gbcPanel0.gridheight = 1
self.gbcPanel0.fill = GridBagConstraints.BOTH
self.gbcPanel0.weightx = 1
self.gbcPanel0.weighty = 0
self.gbcPanel0.anchor = GridBagConstraints.NORTH
self.gbPanel0.setConstraints( self.Label_2, self.gbcPanel0 )
self.panel0.add( self.Label_2 )
self.IP_Address_TF = JTextField(20, focusLost=self.setIPAddress)
self.IP_Address_TF.setEnabled(True)
self.gbcPanel0.gridx = 4
self.gbcPanel0.gridy = 5
self.gbcPanel0.gridwidth = 1
self.gbcPanel0.gridheight = 1
self.gbcPanel0.fill = GridBagConstraints.BOTH
self.gbcPanel0.weightx = 1
self.gbcPanel0.weighty = 0
self.gbcPanel0.anchor = GridBagConstraints.NORTH
self.gbPanel0.setConstraints( self.IP_Address_TF, self.gbcPanel0 )
self.panel0.add( self.IP_Address_TF )
self.Blank_2 = JLabel( " ")
self.Blank_2.setEnabled(True)
self.gbcPanel0.gridx = 2
self.gbcPanel0.gridy = 7
self.gbcPanel0.gridwidth = 1
self.gbcPanel0.gridheight = 1
self.gbcPanel0.fill = GridBagConstraints.BOTH
self.gbcPanel0.weightx = 1
self.gbcPanel0.weighty = 0
self.gbcPanel0.anchor = GridBagConstraints.NORTH
self.gbPanel0.setConstraints( self.Blank_2, self.gbcPanel0 )
self.panel0.add( self.Blank_2 )
self.Label_3 = JLabel("Port Number")
self.Label_3.setEnabled(True)
self.gbcPanel0.gridx = 2
self.gbcPanel0.gridy = 9
self.gbcPanel0.gridwidth = 1
#.........这里部分代码省略.........
示例8: CuckooSettingsWithUISettingsPanel
# 需要导入模块: from javax.swing import JTextField [as 别名]
# 或者: from javax.swing.JTextField import setEnabled [as 别名]
class CuckooSettingsWithUISettingsPanel(IngestModuleIngestJobSettingsPanel):
# Note, we can't use a self.settings instance variable.
# Rather, self.local_settings is used.
# https://wiki.python.org/jython/UserGuide#javabean-properties
# Jython Introspector generates a property - 'settings' on the basis
# of getSettings() defined in this class. Since only getter function
# is present, it creates a read-only 'settings' property. This auto-
# generated read-only property overshadows the instance-variable -
# 'settings'
# We get passed in a previous version of the settings so that we can
# prepopulate the UI
# TODO: Update this for your UI
def __init__(self, settings):
self.local_settings = settings
self.tag_list = []
self.initComponents()
self.customizeComponents()
self.path_to_cuckoo_exe = os.path.join(os.path.dirname(os.path.abspath(__file__)), "cuckoo_api.exe")
# Check the checkboxs to see what actions need to be taken
def checkBoxEvent(self, event):
if self.Submit_File_CB.isSelected():
self.local_settings.setSetting('Submit_File', 'true')
self.local_settings.setSetting('Submit_URL', 'false')
else:
self.local_settings.setSetting('Submit_File', 'false')
def onchange_lb(self, event):
self.local_settings.cleartag_list()
list_selected = self.List_Box_LB.getSelectedValuesList()
self.local_settings.setSetting('tag_list', str(list_selected))
def find_tags(self):
sql_statement = "SELECT distinct(display_name) u_tag_name FROM content_tags INNER JOIN tag_names ON " + \
" content_tags.tag_name_id = tag_names.tag_name_id;"
skCase = Case.getCurrentCase().getSleuthkitCase()
dbquery = skCase.executeQuery(sql_statement)
resultSet = dbquery.getResultSet()
while resultSet.next():
self.tag_list.append(resultSet.getString("u_tag_name"))
dbquery.close()
# Check to see if the Cuckoo server is available and you can talk to it
def Check_Server(self, e):
pipe = Popen([self.path_to_cuckoo_exe, self.Protocol_TF.getText(),self.IP_Address_TF.getText(), self.Port_Number_TF.getText(), "cuckoo_status" ], stdout=PIPE, stderr=PIPE)
out_text = pipe.communicate()[0]
self.Error_Message.setText("Cuckoo Status is " + out_text)
#self.log(Level.INFO, "Cuckoo Status is ==> " + out_text)
def setIPAddress(self, event):
self.local_settings.setSetting('IP_Address', self.IP_Address_TF.getText())
def setProtocol(self, event):
self.local_settings.setSetting('Protocol', self.Protocol_TF.getText())
def setPortNumber(self, event):
self.local_settings.setSetting('Port_Number', self.Port_Number_TF.getText())
# Create the initial data fields/layout in the UI
def initComponents(self):
self.panel0 = JPanel()
self.rbgPanel0 = ButtonGroup()
self.gbPanel0 = GridBagLayout()
self.gbcPanel0 = GridBagConstraints()
self.panel0.setLayout( self.gbPanel0 )
self.Label_1 = JLabel("Protocol:")
self.Label_1.setEnabled(True)
self.gbcPanel0.gridx = 2
self.gbcPanel0.gridy = 1
self.gbcPanel0.gridwidth = 1
self.gbcPanel0.gridheight = 1
self.gbcPanel0.fill = GridBagConstraints.BOTH
self.gbcPanel0.weightx = 1
self.gbcPanel0.weighty = 0
self.gbcPanel0.anchor = GridBagConstraints.NORTH
self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 )
self.panel0.add( self.Label_1 )
self.Protocol_TF = JTextField(20, focusLost=self.setProtocol)
self.Protocol_TF.setEnabled(True)
self.gbcPanel0.gridx = 4
self.gbcPanel0.gridy = 1
self.gbcPanel0.gridwidth = 1
self.gbcPanel0.gridheight = 1
self.gbcPanel0.fill = GridBagConstraints.BOTH
self.gbcPanel0.weightx = 1
self.gbcPanel0.weighty = 0
self.gbcPanel0.anchor = GridBagConstraints.NORTH
self.gbPanel0.setConstraints( self.Protocol_TF, self.gbcPanel0 )
self.panel0.add( self.Protocol_TF )
self.Blank_1 = JLabel( " ")
self.Blank_1.setEnabled(True)
#.........这里部分代码省略.........