⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menumanager.java

📁 myjxta是用jxta开发的一个p2p通讯软件 有聊天 文件共享 视频3大功能 界面采用swing
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        return buildMenuItem(l, KeyEvent.VK_S,                STRINGS.getString("tip.peer.status"),                new PeerStatusAction(l, this.view));    }    private JMenuItem buildPeerProfileMenu() {        String l = STRINGS.getString("menu.peer.profile");        return buildMenuItem(l, KeyEvent.VK_S,                STRINGS.getString("tip.peer.profile"),                new PeerProfileAction(l, this.view));    }    private JMenuItem buildPeerAddMenu() {        String l = STRINGS.getString("menu.peer.friend.add");        return buildMenuItem(l, KeyEvent.VK_A,                STRINGS.getString("tip.peer.friend.add"),                new PeerAddAction(l));    }    private JMenuItem buildPeerRemoveMenu() {        String l = STRINGS.getString("menu.peer.friend.remove");        return buildMenuItem(l, KeyEvent.VK_R,                STRINGS.getString("tip.peer.friend.remove"),                new PeerRemoveAction(l));    }    private JMenu buildGroupsMenu() {        JMenu m = new JMenu(STRINGS.getString("menu.group"));        m.setMnemonic(KeyEvent.VK_G);        m.add(buildGroupSearchMenu());        m.add(buildGroupChatMenu());        m.add(buildGroupCreateMenu());        m.add(buildGroupJoinMenu());        m.add(buildGroupLeaveMenu());        m.add(buildGroupManagementMenu());        return m;    }    private JMenuItem buildGroupSearchMenu() {        String l = STRINGS.getString("menu.group.find");        return buildMenuItem(l, KeyEvent.VK_G,                STRINGS.getString("tip.group.find"),                new GroupSearchAction(l, this.view));    }    private JMenuItem buildGroupChatMenu() {        String l = STRINGS.getString("menu.group.chat");        return buildMenuItem(l, KeyEvent.VK_G,                STRINGS.getString("tip.group.chat"),                new GroupChatAction(l, this.view));    }    private JMenuItem buildGroupCreateMenu() {        String l = STRINGS.getString("menu.group.create");        return buildMenuItem(l, STRINGS.getString("tip.group.create"),                new GroupCreateAction(l, this.view));    }    private JMenuItem buildGroupJoinMenu() {        String l = STRINGS.getString("menu.group.join");        return buildMenuItem(l, STRINGS.getString("tip.group.join"),                new GroupJoinAction(l, this.view));    }    private JMenuItem buildGroupLeaveMenu() {        String l = STRINGS.getString("menu.group.leave");        return buildMenuItem(l, KeyEvent.VK_L,                STRINGS.getString("tip.group.leave"),                new GroupResignAction(l, this.view));    }    private JMenuItem buildGroupManagementMenu() {        String l = STRINGS.getString("menu.group.manage");        return buildMenuItem(l, KeyEvent.VK_M,                STRINGS.getString("tip.group.manage"),                new GroupManagementAction(l, this.view));    }    private JMenu buildShareMenu() {        JMenu m = new JMenu(STRINGS.getString("menu.share"));        m.setMnemonic(KeyEvent.VK_F);        m.add(buildShareSearchMenu());        m.add(buildShareAddMenu());        m.add(buildShareRemoveMenu());        m.add(buildShareViewMenu());        m.add(buildShareSaveMenu());        // todo: re-enable as a plugin        //m.add(buildBeamMenu());        return m;    }    private JMenuItem buildShareSearchMenu() {        String l = STRINGS.getString("menu.share.find");        return buildMenuItem(l, KeyEvent.VK_F,                STRINGS.getString("tip.share.find"),                new ShareSearchAction(l, this.view));    }    private JMenuItem buildShareAddMenu() {        String l = STRINGS.getString("menu.share.add");        return buildMenuItem(l, KeyEvent.VK_F,                STRINGS.getString("tip.share.add"),                new ShareAddAction(l, this.view));    }    private JMenuItem buildShareRemoveMenu() {        String l = STRINGS.getString("menu.share.remove");        return buildMenuItem(l, KeyEvent.VK_R,                STRINGS.getString("tip.share.remove"),                new ShareRemoveAction(l, this.view));    }    private JMenuItem buildShareViewMenu() {        String l = STRINGS.getString("menu.share.view");        return buildMenuItem(l, KeyEvent.VK_V,                STRINGS.getString("tip.share.view"),                new ShareViewAction(l, this.view));    }    private JMenuItem buildShareSaveMenu() {        String l = STRINGS.getString("menu.share.save");        return buildMenuItem(l, KeyEvent.VK_S,                STRINGS.getString("tip.share.save"),                new ShareSaveAction(l, this.view));    }//    private JMenuItem buildBeamMenu() {//        String l = "beam";////        return buildMenuItem(l, KeyEvent.VK_B, "beam",//            new BeamAction(l, (MyJXTAView)this.view));//    }    private JMenu buildPluginsMenu() {        JMenu m = new JMenu(STRINGS.getString("menu.plugins"));        m.setMnemonic(KeyEvent.VK_P);        Plugin[] plugins = this.view.getControl().getPluginContainer().getPlugins();        PluginContainer pluginContainer = this.view.getControl().getPluginContainer();        for (int i = 0; i < plugins.length; i++) {            final Plugin plugin = plugins[i];            String name = plugin.getName();            if (name != null) {                JCheckBoxMenuItem pluginAction = new JCheckBoxMenuItem(new PluginAction(name, plugins[i])){                    public boolean isSelected(){                	return plugin.isRunning();                    }                };                pluginAction.setState(plugin.isRunning());                m.add(pluginAction);            }        }        m.setEnabled(m.getMenuComponentCount() > 0);        m.addMenuListener(new AbstractMenuListener(m) {            public void menuSelected(MenuEvent me) {                Component comps[]=m.getMenuComponents();                for (int i=0;i<comps.length;i++){                    JCheckBoxMenuItem checkBox=(JCheckBoxMenuItem) comps[i];                    checkBox.setSelected(checkBox.isSelected());                }                                            }        });        return m;    }    private JMenu buildHelpMenu() {        JMenu m = new JMenu(STRINGS.getString("menu.help"));        m.setMnemonic(KeyEvent.VK_H);        m.add(buildHelpAboutMenu());        return m;    }    private JMenuItem buildHelpAboutMenu() {        String l = STRINGS.getString("menu.about");        return buildMenuItem(l, KeyEvent.VK_A,                STRINGS.getString("tip.about"),                new AboutAction(l, this.view));    }//    private JMenuItem buildMenuItem(String label, Action action) {//        return buildMenuItem(label, label, action);//    }    private JMenuItem buildMenuItem(String label, int mnemonic,                                    Action action) {        return buildMenuItem(label, mnemonic, label, action);    }    private JMenuItem buildMenuItem(String label, String access,                                    Action action) {        return buildMenuItem(label, -1, access, action);    }    private JMenuItem buildMenuItem(String label, int mnemonic,                                    String access, Action action) {        return buildMenuItem(label, mnemonic, -1, access, action);    }    private JMenuItem buildMenuItem(String label, int mnemonic,                                    int modifier, String access, Action action) {        JMenuItem mi = mnemonic > -1 ?                new JMenuItem(label, mnemonic) : new JMenuItem(label);        mi.setText(label);        if (mnemonic > -1 &&                modifier > -1) {            mi.setAccelerator(KeyStroke.getKeyStroke(mnemonic, modifier));        }        if (access != null) {            mi.getAccessibleContext().setAccessibleDescription(access);        }        mi.setAction(action);        g_actions.put(mi, action);        return mi;    }    public void updateMenuStatus() {        Set<JMenuItem> keys = g_actions.keySet();        for (Iterator<JMenuItem> it = keys.iterator(); it.hasNext();) {            Object key = it.next();            JMenuItem jMenuItem = (JMenuItem) key;            Action action = g_actions.get(jMenuItem);            jMenuItem.setEnabled(action.isEnabled());        }    }    public HashMap<String,Action> getPluginActionMap() {	return g_pluginActions;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -