本文整理汇总了Python中javax.swing.JMenuItem.addActionListener方法的典型用法代码示例。如果您正苦于以下问题:Python JMenuItem.addActionListener方法的具体用法?Python JMenuItem.addActionListener怎么用?Python JMenuItem.addActionListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JMenuItem
的用法示例。
在下文中一共展示了JMenuItem.addActionListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: menu
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
def menu(self):
f = JMenu("File")
o = JMenuItem("Copy")
o.addActionListener(ActionEventListener(self.opencopy))
self.open = o
f.add(o)
o = JMenuItem("New")
o.addActionListener(ActionEventListener(self.new))
self.open = o
f.add(o)
o = JMenuItem("Open")
o.addActionListener(ActionEventListener(self.opendialog))
self.open = o
f.add(o)
o = JMenuItem("Save")
o.addActionListener(ActionEventListener(self.save))
self.open = o
f.add(o)
o = JMenuItem("Save As")
o.addActionListener(ActionEventListener(self.saveas))
self.open = o
f.add(o)
return f
示例2: createMenuItems
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
def createMenuItems(self, invocation):
if invocation.getInvocationContext() != invocation.CONTEXT_MESSAGE_EDITOR_REQUEST:
return None
menuItem = JMenuItem("Evaluate Groovy")
menuItem.addActionListener(
GroovyActionListener(invocation.getSelectedMessages()[0], invocation.getSelectionBounds()))
return [menuItem]
示例3: handleMouseEvent
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
def handleMouseEvent(self, event):
if event.isPopupTrigger():
loadMenu = JMenuItem("Load .proto")
loadMenu.addActionListener(self.tab.listener)
popup = JPopupMenu()
popup.add(loadMenu)
if self.tab.descriptors:
deserializeAsMenu = JMenu("Deserialize As...")
popup.addSeparator()
popup.add(deserializeAsMenu)
for pb2, descriptors in self.tab.descriptors.iteritems():
subMenu = JMenu(pb2)
deserializeAsMenu.add(subMenu)
for name, descriptor in descriptors.iteritems():
protoMenu = JMenuItem(name)
protoMenu.addActionListener(
DeserializeProtoActionListener(self.tab, descriptor))
subMenu.add(protoMenu)
popup.show(event.getComponent(), event.getX(), event.getY())
return
示例4: createMenuItems
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
def createMenuItems(self, invocation):
'''
Invoked by Burp when a right-click menu is created; adds Git Bridge's
options to the menu.
'''
context = invocation.getInvocationContext()
tool = invocation.getToolFlag()
if tool == self.callbacks.TOOL_REPEATER:
if context in [invocation.CONTEXT_MESSAGE_EDITOR_REQUEST, invocation.CONTEXT_MESSAGE_VIEWER_RESPONSE]:
item = JMenuItem("Send to Git Bridge")
item.addActionListener(self.RepeaterHandler(self.callbacks, invocation, self.log))
items = ArrayList()
items.add(item)
return items
elif tool == self.callbacks.TOOL_SCANNER:
if context in [invocation.CONTEXT_SCANNER_RESULTS]:
item = JMenuItem("Send to Git Bridge")
item.addActionListener(self.ScannerHandler(self.callbacks, invocation, self.log))
items = ArrayList()
items.add(item)
return items
else:
# TODO: add support for other tools
pass
示例5: initTabs
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
def initTabs(self):
#
## init autorize tabs
#
self.logTable = Table(self)
self.logTable.setAutoCreateRowSorter(True)
tableWidth = self.logTable.getPreferredSize().width
self.logTable.getColumn("ID").setPreferredWidth(Math.round(tableWidth / 50 * 2))
self.logTable.getColumn("URL").setPreferredWidth(Math.round(tableWidth / 50 * 24))
self.logTable.getColumn("Orig. Length").setPreferredWidth(Math.round(tableWidth / 50 * 4))
self.logTable.getColumn("Modif. Length").setPreferredWidth(Math.round(tableWidth / 50 * 4))
self.logTable.getColumn("Unauth. Length").setPreferredWidth(Math.round(tableWidth / 50 * 4))
self.logTable.getColumn("Authorization Enforcement Status").setPreferredWidth(Math.round(tableWidth / 50 * 4))
self.logTable.getColumn("Authorization Unauth. Status").setPreferredWidth(Math.round(tableWidth / 50 * 4))
self._splitpane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT)
self._splitpane.setResizeWeight(1)
self.scrollPane = JScrollPane(self.logTable)
self._splitpane.setLeftComponent(self.scrollPane)
self.scrollPane.getVerticalScrollBar().addAdjustmentListener(autoScrollListener(self))
self.menuES0 = JCheckBoxMenuItem(self._enfocementStatuses[0],True)
self.menuES1 = JCheckBoxMenuItem(self._enfocementStatuses[1],True)
self.menuES2 = JCheckBoxMenuItem(self._enfocementStatuses[2],True)
self.menuES0.addItemListener(menuTableFilter(self))
self.menuES1.addItemListener(menuTableFilter(self))
self.menuES2.addItemListener(menuTableFilter(self))
copyURLitem = JMenuItem("Copy URL");
copyURLitem.addActionListener(copySelectedURL(self))
self.menu = JPopupMenu("Popup")
self.menu.add(copyURLitem)
self.menu.add(self.menuES0)
self.menu.add(self.menuES1)
self.menu.add(self.menuES2)
self.tabs = JTabbedPane()
self._requestViewer = self._callbacks.createMessageEditor(self, False)
self._responseViewer = self._callbacks.createMessageEditor(self, False)
self._originalrequestViewer = self._callbacks.createMessageEditor(self, False)
self._originalresponseViewer = self._callbacks.createMessageEditor(self, False)
self._unauthorizedrequestViewer = self._callbacks.createMessageEditor(self, False)
self._unauthorizedresponseViewer = self._callbacks.createMessageEditor(self, False)
self.tabs.addTab("Modified Request", self._requestViewer.getComponent())
self.tabs.addTab("Modified Response", self._responseViewer.getComponent())
self.tabs.addTab("Original Request", self._originalrequestViewer.getComponent())
self.tabs.addTab("Original Response", self._originalresponseViewer.getComponent())
self.tabs.addTab("Unauthenticated Request", self._unauthorizedrequestViewer.getComponent())
self.tabs.addTab("Unauthenticated Response", self._unauthorizedresponseViewer.getComponent())
self.tabs.addTab("Configuration", self.pnl)
self.tabs.setSelectedIndex(6)
self._splitpane.setRightComponent(self.tabs)
示例6: createMenuItems
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
def createMenuItems(self, invocation):
def addRequestsToTab(e):
for messageInfo in messages:
# saveBuffers is required since modifying the original from its source changes the saved objects, its not a copy
messageIndex = self._db.createNewMessage(self._callbacks.saveBuffersToTempFiles(messageInfo),
self._helpers.analyzeRequest(messageInfo).getUrl())
#self._messageTable.getModel().addRow(row)
self._messageTable.redrawTable()
ret = []
messages = invocation.getSelectedMessages()
# Check if the messages in the target tree have a response
valid = True
if invocation.getInvocationContext() == invocation.CONTEXT_TARGET_SITE_MAP_TREE:
for selected in messages:
if not selected.getResponse():
valid = False
if valid:
menuItem = JMenuItem("Send request(s) to AuthMatrix");
menuItem.addActionListener(addRequestsToTab)
ret.append(menuItem)
return ret
示例7: actionPerformed
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
def actionPerformed(self, event):
messages = self.browser.getSelectedMessages()
numMessages = messages.size()
if numMessages == 0:
self.browser.showInformationDialog("No messages selected")
return
if numMessages > 1:
self.browser.showInformationDialog("%d messages selected, choose one" % numMessages)
return
message = messages.get(0)
replyToId = message.getJMSMessageID()
replyToQueue0 = message.getJMSReplyTo()
if replyToQueue0 != None:
replyToQueue0 = replyToQueue0.getQueueName()
p = Pattern.compile("[^\\s:/]+://[^\\s:/]*/([^\\s:/?]+)\\??.*")
m = p.matcher(replyToQueue0)
if m.matches():
replyToQueue0 = m.group(1)
else:
replyToQueue0 = None
dNode = self.browser.getBrowserTree().getFirstSelectedDestinationNode()
hNode = self.browser.getBrowserTree().getSelectedHermesNode()
if dNode == None or hNode == None:
self.browser.showInformationDialog("Unknown destination, select destination queue")
return
hermes = hNode.getHermes()
replyToQueue1 = dNode.getDestinationName()
replyToDomain = dNode.getDomain()
if replyToQueue0 == None and replyToQueue1 == None:
self.browser.showInformationDialog("Unknown destination, select destination queue")
return
# show menu
if replyToQueue0 != None and replyToQueue1 != None and replyToQueue0 != replyToQueue1:
menu = JPopupMenu()
q0item = JMenuItem(replyToQueue0)
q0item.addActionListener(MenuItemHandler(self, hermes, replyToId, replyToQueue0, replyToDomain))
menu.add(q0item)
q1item = JMenuItem(replyToQueue1)
q1item.addActionListener(MenuItemHandler(self, hermes, replyToId, replyToQueue1, replyToDomain))
menu.add(q1item)
menu.show(self.button, 0, self.button.getHeight())
return
# show new message dialog
else:
if replyToQueue0 != None:
replyToQueue = replyToQueue0
else:
replyToQueue = replyToQueue1
self.replyTo(hermes, replyToId, replyToQueue, replyToDomain)
示例8: createMenuItems
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
def createMenuItems(self, invocation):
responses = invocation.getSelectedMessages();
if responses > 0:
ret = LinkedList()
requestMenuItem = JMenuItem("Send to PT Manager");
requestMenuItem.addActionListener(handleMenuItems(self,responses[0], "request"))
ret.add(requestMenuItem);
return(ret);
return null;
示例9: add_check_item
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
def add_check_item(self, tool, view, check, viewMenu):
checkItem = JMenuItem(check.title)
if check.icon is not None:
checkItem.setIcon(check.icon)
checkItem.addActionListener(QatMenuActionListener(self.app,
"check",
tool,
view,
check))
viewMenu.add(checkItem)
示例10: __init__
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
def __init__(self, app, menuTitle):
JMenu.__init__(self, menuTitle)
self.app = app
#quat dialog item
dialogItem = JCheckBoxMenuItem(self.app.dlg.toggleAction)
self.add(dialogItem)
self.addSeparator()
#tool submenu
for tool in self.app.tools:
if tool.name == "favourites":
self.addSeparator()
toolMenu = JMenu(tool.title)
toolMenu.setIcon(tool.bigIcon)
if tool.uri != "":
#Website link
iconFile = File.separator.join([self.app.SCRIPTDIR,
"images",
"icons",
"browser.png"])
urlItem = JMenuItem(tool.title)
urlItem.setIcon(ImageIcon(iconFile))
urlItem.addActionListener(QatMenuActionListener(self.app,
"link",
tool))
toolMenu.add(urlItem)
toolMenu.addSeparator()
#View submenu
for view in tool.views:
viewMenu = JMenu(view.title)
if tool.name == "favourites":
self.app.favouritesMenu = viewMenu
#Check item
for check in view.checks:
self.add_check_item(tool, view, check, viewMenu)
toolMenu.add(viewMenu)
self.add(toolMenu)
#Local file with errors
localFileItem = JMenuItem(self.app.strings.getString("Open_GPX"))
localFileItem.setIcon(ImageProvider.get("open"))
localFileItem.addActionListener(QatMenuActionListener(self.app, "local file"))
self.add(localFileItem)
self.addSeparator()
#False positive dialog
falsepositiveItem = JMenuItem(self.app.strings.getString("False_positives..."))
falsepositiveItem.addActionListener(QatMenuActionListener(self.app, "dialog"))
self.add(falsepositiveItem)
#Preferences dialog
preferencesItem = JMenuItem(self.app.strings.getString("Preferences..."))
preferencesItem.addActionListener(QatMenuActionListener(self.app, "dialog"))
self.add(preferencesItem)
#About dialog item
aboutItem = JMenuItem(self.app.strings.getString("About..."))
aboutItem.addActionListener(QatMenuActionListener(self.app, "dialog"))
self.add(aboutItem)
示例11: generate_menu_items
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
def generate_menu_items(self):
for k in self.items:
#print k + '\n'
#menuitem = JMenuItem(k, actionPerformed=self.menuItemClicked)
menuitem = JMenuItem(k)
#menu.append(JMenuItem(self._actionName, None , actionPerformed= lambda x, inv=invocation: self.sqlMapScan(inv)))
menuitem.addActionListener(ActionHandler(self._callbacks, k, self._helers))
self.menuitems[menuitem] = k
示例12: createMenuItems
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
def createMenuItems(self, invocation):
responses = invocation.getSelectedMessages();
if responses > 0:
ret = LinkedList()
requestMenuItem = JMenuItem("Send request to Autorize");
cookieMenuItem = JMenuItem("Send cookie to Autorize");
requestMenuItem.addActionListener(handleMenuItems(self,responses[0], "request"))
cookieMenuItem.addActionListener(handleMenuItems(self, responses[0], "cookie"))
ret.add(requestMenuItem);
ret.add(cookieMenuItem);
return(ret);
return null;
示例13: createMenuItems
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
def createMenuItems(self, invocation):
menus = []
messages = invocation.getSelectedMessages()
if messages:
items = self.interpreter.getLocals().get('items', [])
context = 'Assign' if not items else 'Append'
menu = JMenuItem("%s to local variable items in Console" % (context, ))
menu.addActionListener(AssignLocalsActionListener(self, 'items', messages))
menus.append(menu)
return menus
示例14: createMenuItems
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
def createMenuItems(self, invocation):
messages = invocation.getSelectedMessages()
def addRequestsToTab(e):
for messageInfo in messages:
# saveBuffers is required since modifying the original from its source changes the saved objects, its not a copy
messageIndex = self._db.createNewMessage(self._callbacks.saveBuffersToTempFiles(messageInfo),
self._helpers.analyzeRequest(messageInfo).getUrl())
#self._messageTable.getModel().addRow(row)
self._messageTable.redrawTable()
ret = []
menuItem = JMenuItem("Send request(s) to AuthMatrix");
menuItem.addActionListener(addRequestsToTab)
ret.append(menuItem)
return(ret)
示例15: BurpExtender
# 需要导入模块: from javax.swing import JMenuItem [as 别名]
# 或者: from javax.swing.JMenuItem import addActionListener [as 别名]
class BurpExtender(IBurpExtender, IContextMenuFactory, ActionListener):
def __init__(self):
self.menuItem = JMenuItem('sqldude')
self.menuItem.addActionListener(self)
def _build(self):
#Grab first selected message, bail if none
iRequestInfo = self._helpers.analyzeRequest(self.ctxMenuInvocation.getSelectedMessages()[0])
if iRequestInfo is None:
print('Request info object is null, bailing')
return
#print(len(iRequestInfo.getParameters()))
#for i in iRequestInfo.getParameters():
# print(i.getName())
#print('cookies: ' + ''.join(cookies))
#parms = [i for i in iRequestInfo.getParameters() if i.getType() == IParameter.PARAM_BODY]
parms = filter(lambda x: x.getType() == IParameter.PARAM_BODY, iRequestInfo.getParameters())
cookies = filter(lambda x: x.getType() == IParameter.PARAM_COOKIE, iRequestInfo.getParameters())
#print('parms ' + ''.join(parms))
payload = 'sqlmap -u \'%s\' --cookies=\'%s\'' % (iRequestInfo.getUrl(), ';'.join([('%s=%s' % (c.getName(),c.getValue())) for c in cookies ]) )
if len(parms) > 0:
p = ['%s=%s' % (p.getName(), p.getValue()) for p in parms]
payload = '%s --data=\'%s\'' % (payload, '&'.join(p))
#print('Found Cookies:\n\t' + '\n\t'.join([('%s=%s' % (c.getName(), c.getValue())) for c in cookies]))
s = StringSelection(payload)
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(s,s) #put string on clipboard
print(payload)
def actionPerformed(self, actionEvent):
self._build()
def registerExtenderCallbacks(self, callbacks):
self._helpers = callbacks.getHelpers()
callbacks.setExtensionName('sqldude')
callbacks.registerContextMenuFactory(self)
self.mCallBacks = callbacks
print('sqldude up')
return
def createMenuItems(self, ctxMenuInvocation):
self.ctxMenuInvocation = ctxMenuInvocation
return [self.menuItem]