當前位置: 首頁>>代碼示例>>Python>>正文


Python JMenuItem.setMnemonic方法代碼示例

本文整理匯總了Python中javax.swing.JMenuItem.setMnemonic方法的典型用法代碼示例。如果您正苦於以下問題:Python JMenuItem.setMnemonic方法的具體用法?Python JMenuItem.setMnemonic怎麽用?Python JMenuItem.setMnemonic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JMenuItem的用法示例。


在下文中一共展示了JMenuItem.setMnemonic方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: DisplayStreetTable

# 需要導入模塊: from javax.swing import JMenuItem [as 別名]
# 或者: from javax.swing.JMenuItem import setMnemonic [as 別名]
def DisplayStreetTable (collection):
    columns=list(
        (
            ("Name","name"),
            )
        )
    tm= ObjectTableModel(collection,columns)
    frame = MyFrame("Street Table")
    frame.setSize(800, 1200)
    frame.setLayout(BorderLayout())
    table = JTable(tm)
    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS)
    header = table.getTableHeader()
    header.setUpdateTableInRealTime(True)
    header.setReorderingAllowed(True);
    scrollPane = JScrollPane()
    scrollPane.getViewport().setView((table))
#    copyButton = JButton('Merge') #,actionPerformed=self.noAction
#    frame.add(copyButton)

    listener=MyListener(table)
    table.addMouseListener(listener)
    table.addKeyListener(listener)

    menubar = JMenuBar()
    file = JMenu("Edit")
    file.setMnemonic(KeyEvent.VK_E)

    lookup = JMenuItem("Lookup",actionPerformed=frame.LookupEvent)
    lookup.setMnemonic(KeyEvent.VK_L)

    file.add(lookup)


    menubar.add(file)



    frame.setJMenuBar(menubar)

    frame.add(scrollPane)


    frame.pack();
    frame.setSize(frame.getPreferredSize());
    frame.show()
開發者ID:h4ck3rm1k3,項目名稱:josm-script-jython-streetrepair,代碼行數:48,代碼來源:readfile.py

示例2: createItems

# 需要導入模塊: from javax.swing import JMenuItem [as 別名]
# 或者: from javax.swing.JMenuItem import setMnemonic [as 別名]
    def createItems(self, menuItems):
        items = []

        #Refer to MenuView's menuItems dictionary where each menu item has an
        #array of two elements, the first is the key event and the second is the
        #action asigned to the menu item
        def getMethod(name):
            return menuItems[name][1]

        def getKeyEvent(name):
            return menuItems[name][0]

        for name, keyEvent in menuItems.items():
            item = JMenuItem(name, actionPerformed =
                             getattr(self.menuView.controller, getMethod(name)))
            item.setMnemonic(getKeyEvent(name))
            items.append(item)

        return items
開發者ID:jenshnielsen,項目名稱:nammu,代碼行數:21,代碼來源:Menu.py

示例3: createAction

# 需要導入模塊: from javax.swing import JMenuItem [as 別名]
# 或者: from javax.swing.JMenuItem import setMnemonic [as 別名]
def createAction(callback, name, description=None, menu=None, mnemonic=None, accelerator=None, toolBar=None, menuItemType="standard"):
    action = CallbackAction(callback, name, description)
    if menu:
        if menuItemType == "standard":
            menuItem = JMenuItem(action)
        elif menuItemType == "checkbox":
            menuItem = JCheckBoxMenuItem(action)
        elif menuItemType == "radiobutton":
            menuItem = JRadioButtonMenuItem(action)
        else:
            internal_error("unsupported menu item type %s" % `menuItemType`)
            menuItem = JMenuItem(action)
        if mnemonic:
            menuItem.setMnemonic(mnemonic)
        if accelerator:
            menuItem.setAccelerator(KeyStroke.getKeyStroke(ord(accelerator), Event.CTRL_MASK, 0))
        menu.add(menuItem)
        action.setMenuItem(menuItem)
    if toolBar:
        toolbarButton = JButton(action)
        toolBar.add(toolbarButton)
    return action
開發者ID:Cybernetic-Shadow,項目名稱:PlantStudio,代碼行數:24,代碼來源:common.py


注:本文中的javax.swing.JMenuItem.setMnemonic方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。