本文整理汇总了Python中javax.swing.JButton方法的典型用法代码示例。如果您正苦于以下问题:Python swing.JButton方法的具体用法?Python swing.JButton怎么用?Python swing.JButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing
的用法示例。
在下文中一共展示了swing.JButton方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JButton [as 别名]
def __init__(self, extender):
# Initialize self
super(ActionsPanel, self).__init__()
self.extender = extender
self.setLayout(GridLayout(2, 1))
# Create children
self.title = JLabel('Actions')
self.actions = JPanel(GridLayout(1, 3))
self.start = JButton('Start')
self.info = JButton('Info')
# Configure children
self.title.setFont(Fonts.Heading)
self.title.setForeground(Colors.Orange)
self.actions.layout.vgap = 0
self.actions.layout.hgap = 0
self.start.addActionListener(StartActionListener(extender))
self.info.addActionListener(InfoActionListener(extender))
# Add children
self.add(self.title)
self.add(self.actions)
self.actions.add(self.start)
self.actions.add(self.info)
示例2: __init__
# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JButton [as 别名]
def __init__(self, callbacks, log):
self.callbacks = callbacks
self.log = log
self.log_table = None # to be set by caller
self.setLayout(BoxLayout(self, BoxLayout.PAGE_AXIS))
label = JLabel("Reload from Git Repo:")
button = JButton("Reload")
button.addActionListener(CommandPanel.ReloadAction(log))
self.add(label)
self.add(button)
label = JLabel("Send selected entries to respective Burp tools:")
button = JButton("Send")
button.addActionListener(CommandPanel.SendAction(self))
self.add(label)
self.add(button)
label = JLabel("Remove selected entries from Git Repo:")
button = JButton("Remove")
button.addActionListener(CommandPanel.RemoveAction(self, log))
self.add(label)
self.add(button)
# TODO: maybe add a git command box
示例3: createButton
# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JButton [as 别名]
def createButton(self, text, command):
"""Generate a new button with a given text and command"""
button = JButton(text)
button.setAlignmentX(Component.CENTER_ALIGNMENT)
button.setActionCommand(command)
button.addActionListener(self._button_listener)
return button
示例4: createButton
# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JButton [as 别名]
def createButton(self, text, command):
"""Generate new button with the given text and command string"""
button = JButton(text)
button.setAlignmentX(Component.CENTER_ALIGNMENT)
button.setActionCommand(command)
button.addActionListener(self._button_listener)
return button
示例5: createButton
# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JButton [as 别名]
def createButton(self, text, command):
"""Create a new button with the given text and command"""
button = JButton(text)
button.setAlignmentX(Component.CENTER_ALIGNMENT)
button.setActionCommand(command)
button.addActionListener(self._button_listener)
return button
示例6: __init__
# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JButton [as 别名]
def __init__(self, hint=None, label=None, action=None):
if not hint: hint = 'Omnibar hint'
if not label: label = 'Run'
if not action: action = nop_evt
self.this = JPanel()
self.this.setLayout(BorderLayout())
# Add an hinttextfield
self._text = _HintTextField(hint, action)
self.this.add(BorderLayout.CENTER, self._text.this)
# Add a run buttpn
button = JButton(label)
button.addActionListener(action)
self.this.add(BorderLayout.EAST, button)
示例7: test_java_bean_properties
# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JButton [as 别名]
def test_java_bean_properties(self):
b1 = swing.JButton()
b1.label = 'foo'
b2 = swing.JButton(label='foo')
self.assertEquals(b1.label, b2.label)
self.assertEquals(b1.label, 'foo')
# Test bean event properties - single and multiple
def testAction(event):
JythonBasicTests.flag += 1
doit = ActionEvent(b1, ActionEvent.ACTION_PERFORMED, "")
b1.actionPerformed = testAction
JythonBasicTests.flag = 0
b1.doClick()
self.assertEquals(
JythonBasicTests.flag, 1,
'expected one action per event but got %s' % JythonBasicTests.flag)
b1.actionPerformed.append(testAction)
JythonBasicTests.flag = 0
b1.doClick()
self.assertEquals(JythonBasicTests.flag, 2, 'two actions per event')
b1.actionPerformed = testAction
JythonBasicTests.flag = 0
b1.doClick()
self.assertEquals(JythonBasicTests.flag, 1,
'one actions per event - again')
示例8: build_gui
# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JButton [as 别名]
def build_gui(self):
"""Construct GUI elements."""
panel = JPanel(BorderLayout(3, 3))
panel.setBorder(EmptyBorder(160, 160, 160, 160))
self.aws_access_key_inpt = JTextField(10)
self.aws_secret_key_inpt = JTextField(10)
self.aws_session_token_inpt = JTextField(10)
self.gs_access_key_inpt = JTextField(10)
self.gs_secret_key_inpt = JTextField(10)
self.wordlist_path_inpt = JTextField(10)
self.passive_mode = JCheckBox('Enabled')
self.ssl_verification = JCheckBox('Enabled')
save_btn = JButton('Save', actionPerformed=self.save_config)
labels = JPanel(GridLayout(0, 1))
inputs = JPanel(GridLayout(0, 1))
panel.add(labels, BorderLayout.WEST)
panel.add(inputs, BorderLayout.CENTER)
top_label = JLabel('<html><b>Settings</b><br><br></html>')
top_label.setHorizontalAlignment(JLabel.CENTER)
panel.add(top_label, BorderLayout.NORTH)
labels.add(JLabel('AWS Access Key:'))
inputs.add(self.aws_access_key_inpt)
labels.add(JLabel('AWS Secret Key:'))
inputs.add(self.aws_secret_key_inpt)
labels.add(JLabel('AWS Session Key (optional):'))
inputs.add(self.aws_session_token_inpt)
labels.add(JLabel('GS Access Key:'))
inputs.add(self.gs_access_key_inpt)
labels.add(JLabel('GS Secret Key:'))
inputs.add(self.gs_secret_key_inpt)
labels.add(JLabel('Wordlist Filepath (optional):'))
inputs.add(self.wordlist_path_inpt)
labels.add(JLabel('Passive Mode:'))
inputs.add(self.passive_mode)
labels.add(JLabel('SSL Verification:'))
inputs.add(self.ssl_verification)
panel.add(save_btn, BorderLayout.SOUTH)
return panel
示例9: initUI
# 需要导入模块: from javax import swing [as 别名]
# 或者: from javax.swing import JButton [as 别名]
def initUI(self):
self.tab = swing.JPanel()
# UI for Output
self.outputLabel = swing.JLabel("LinkFinder Log:")
self.outputLabel.setFont(Font("Tahoma", Font.BOLD, 14))
self.outputLabel.setForeground(Color(255,102,52))
self.logPane = swing.JScrollPane()
self.outputTxtArea = swing.JTextArea()
self.outputTxtArea.setFont(Font("Consolas", Font.PLAIN, 12))
self.outputTxtArea.setLineWrap(True)
self.logPane.setViewportView(self.outputTxtArea)
self.clearBtn = swing.JButton("Clear Log", actionPerformed=self.clearLog)
self.exportBtn = swing.JButton("Export Log", actionPerformed=self.exportLog)
self.parentFrm = swing.JFileChooser()
# Layout
layout = swing.GroupLayout(self.tab)
layout.setAutoCreateGaps(True)
layout.setAutoCreateContainerGaps(True)
self.tab.setLayout(layout)
layout.setHorizontalGroup(
layout.createParallelGroup()
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup()
.addComponent(self.outputLabel)
.addComponent(self.logPane)
.addComponent(self.clearBtn)
.addComponent(self.exportBtn)
)
)
)
layout.setVerticalGroup(
layout.createParallelGroup()
.addGroup(layout.createParallelGroup()
.addGroup(layout.createSequentialGroup()
.addComponent(self.outputLabel)
.addComponent(self.logPane)
.addComponent(self.clearBtn)
.addComponent(self.exportBtn)
)
)
)