本文整理匯總了Python中javax.swing.JTextField方法的典型用法代碼示例。如果您正苦於以下問題:Python swing.JTextField方法的具體用法?Python swing.JTextField怎麽用?Python swing.JTextField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing
的用法示例。
在下文中一共展示了swing.JTextField方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from javax import swing [as 別名]
# 或者: from javax.swing import JTextField [as 別名]
def __init__(self, hint=None, action=None):
if not hint: hint = 'hint'
if not action: action = nop_evt
self.this = JTextField(hint)
self._hint = hint
self._showing_hint = True
self._enter_listener = None
self.this.addFocusListener(self)
self.this.addKeyListener(self)
self.set_enter_evt_listener(action)
示例2: build_gui
# 需要導入模塊: from javax import swing [as 別名]
# 或者: from javax.swing import JTextField [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