当前位置: 首页>>代码示例>>Python>>正文


Python JMenuItem.addActionListener方法代码示例

本文整理汇总了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
开发者ID:silvioangels,项目名称:cb2java-1,代码行数:31,代码来源:window.py

示例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]
开发者ID:BruceLEO1969,项目名称:BurpKit,代码行数:9,代码来源:groovyTemplater.py

示例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
开发者ID:0x24bin,项目名称:BurpSuite,代码行数:31,代码来源:protoburp.py

示例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
开发者ID:0x24bin,项目名称:BurpSuite,代码行数:27,代码来源:burp_git_bridge.py

示例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)
开发者ID:federicodotta,项目名称:Autorize,代码行数:62,代码来源:Autorize.py

示例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
开发者ID:webpentest-factory,项目名称:AuthMatrix,代码行数:27,代码来源:AuthMatrix.py

示例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)
开发者ID:yumauri,项目名称:HermesJMS-reply-plugin,代码行数:59,代码来源:plugin.py

示例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;
开发者ID:anhnt4288,项目名称:PT-Manager,代码行数:11,代码来源:PTManager.py

示例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)
开发者ID:alex85k,项目名称:qat_script,代码行数:12,代码来源:QatMenu.py

示例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)
开发者ID:alex85k,项目名称:qat_script,代码行数:57,代码来源:QatMenu.py

示例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
开发者ID:d4wner,项目名称:url_fuzz,代码行数:13,代码来源:pentest_api.py

示例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;
开发者ID:federicodotta,项目名称:Autorize,代码行数:14,代码来源:Autorize.py

示例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
开发者ID:mwielgoszewski,项目名称:burp-jython-tab,代码行数:14,代码来源:burpconsole.py

示例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)
开发者ID:patanax,项目名称:AuthMatrix,代码行数:18,代码来源:AuthMatrix.py

示例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]
开发者ID:faffi,项目名称:sqldude,代码行数:47,代码来源:sqldude.py


注:本文中的javax.swing.JMenuItem.addActionListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。