当前位置: 首页>>代码示例>>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;未经允许,请勿转载。