Package javax.swing

Examples of javax.swing.JMenuItem


    }
  }

  public JPopupMenu getPopupMenu() {
    JPopupMenu menu = new JPopupMenu();
    JMenuItem defaultMI = new JMenuItem(mDefaultAction);
    menu.add(defaultMI);
    defaultMI.setFont(MenuUtil.CONTEXT_MENU_BOLDFONT);
    menu.add(getExpandAllMenuItem(mPath));
    menu.add(getCollapseAllMenuItem(mPath));
    menu.add(getFilterMenuItem(mPath));
    menu.add(getExportMenu( mPath));
   
    ActionMenu pluginAction = getButtonAction();
    if (pluginAction != null) {
      menu.addSeparator();
      Action action = pluginAction.getAction();
      JMenuItem pluginMI = new JMenuItem(action);
      pluginMI.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
      menu.add(pluginMI);
    }

    if (mActionMenus.length>0) {
      for (ActionMenu actionMenu : mActionMenus) {
        JMenuItem menuItem = MenuUtil.createMenuItem(actionMenu);
        menu.add(menuItem);
      }
    }

    menu.addSeparator();
    if (hasSettingsTab()) {
      JMenuItem menuItem = MenuUtil.createMenuItem(Localizer.getEllipsisLocalization(Localizer.I18N_SETTINGS));
      menuItem.setIcon(TVBrowserIcons.preferences(TVBrowserIcons.SIZE_SMALL));
      menuItem.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e) {
          MainFrame.getInstance().showSettingsDialog(getPluginId());
        }
      });
      menu.add(menuItem);
    }
    JMenuItem menuItem = MenuUtil.createMenuItem(mLocalizer.msg(
        "disablePlugin", "Disable plugin"));
    menuItem.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        final PluginProxy plugin = PluginProxyManager.getInstance()
            .getPluginForId(getPluginId());
        if (plugin != null) {
          try {
            PluginProxyManager.getInstance().deactivatePlugin(plugin);
          } catch (TvBrowserException e1) {
            e1.printStackTrace();
          }
        }
      }
    });
    menu.add(menuItem);
    ImageIcon icon = IconLoader.getInstance().getIconFromTheme("apps",
        "help-browser", 16);
    menuItem = MenuUtil.createMenuItem(Localizer.getLocalization(Localizer.I18N_HELP));
    menuItem.setIcon(icon);
    menuItem.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        final PluginProxy plugin = PluginProxyManager.getInstance()
            .getPluginForId(getPluginId());
        if (plugin != null) {
          String helpUrl = plugin.getInfo().getHelpUrl();
View Full Code Here


  }

  public JPopupMenu getPopupMenu() {
    JPopupMenu menu = new JPopupMenu();
    if (mDefaultAction != null) {
      JMenuItem defaultMI = new JMenuItem(mDefaultAction);
      menu.add(defaultMI);
      defaultMI.setFont(MenuUtil.CONTEXT_MENU_BOLDFONT);
    }

    if (((Node) mPath.getLastPathComponent()).getAllowsChildren()) {
      menu.add(getExpandAllMenuItem(mPath));
      menu.add(getCollapseAllMenuItem(mPath));
      menu.add(getFilterMenuItem(mPath));
      menu.add(getExportMenu(mPath));
    }

    if (mActionMenus.length>0) {
      if (mDefaultAction != null) {
        menu.addSeparator();
      }
      for (ActionMenu actionMenu : mActionMenus) {
        if (actionMenu.getAction() != mDefaultAction) {
          JMenuItem menuItem = MenuUtil.createMenuItem(actionMenu);
          if (menuItem == null) {
            menu.addSeparator();
          } else {
            menu.add(menuItem);
          }
View Full Code Here

    mDefaultAction.putValue(Action.NAME, mLocalizer.msg("show", "show"));
  }

  public JPopupMenu getPopupMenu() {
    JPopupMenu menu = new JPopupMenu();
    JMenuItem showMI = new JMenuItem(mDefaultAction);
    showMI.setFont(MenuUtil.CONTEXT_MENU_BOLDFONT);

    showMI.setEnabled(mPaths.length == 1);
    menu.add(showMI);

    menu.add(getExportMenu(mPaths[0]));

    menu.addSeparator();
View Full Code Here

      }
    };

    action.putValue(Action.NAME, mLocalizer.msg("expandAll","Expand All"));

    JMenuItem item = new JMenuItem(action);
    item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
    return item;
  }
View Full Code Here

    };

    action.putValue(Action.NAME, mLocalizer.msg("collapseAll",
        "Collapse All"));

    JMenuItem item = new JMenuItem(action);
    item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
    return item;
  }
View Full Code Here

    for (InternalPluginProxyIf internalProxy : InternalPluginProxyList.getInstance().getAvailableProxys()) {
      if (internalProxy instanceof ProgramReceiveIf) {
        final ProgramReceiveIf receiveProxy = (ProgramReceiveIf) internalProxy;
        if(receiveProxy.canReceiveProgramsWithTarget() && o != internalProxy) {
          final ProgramReceiveTarget target = receiveProxy.getProgramReceiveTargets()[0];
          JMenuItem item = new JMenuItem(target.getTargetName());
          item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
          item.setIcon(internalProxy.getIcon());
          menu.add(item);
          item.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e) {
              Program[] programs = collectProgramsFromNode(node);
              if ((programs != null) &&(programs.length > 0)) {
                receiveProxy.receivePrograms(programs, target);
              }
            }
          });
        }
      }
    }

    PluginProxy[] plugins = PluginProxyManager.getInstance().getActivatedPlugins();
    for (final PluginProxy plugin : plugins) {
     if ((plugin.canReceiveProgramsWithTarget())
          && plugin.getProgramReceiveTargets() != null
          && plugin.getProgramReceiveTargets().length > 0) {
        if ((currentPlugin == null) || (!currentPlugin.getId().equals(plugin.getId()))) {
          ProgramReceiveTarget[] targets = plugin.getProgramReceiveTargets();
          if (!plugin.canReceiveProgramsWithTarget()) {
            JMenuItem item = new JMenuItem(plugin.getInfo().getName());
            item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);

            Icon icon = plugin.getPluginIcon();

            item.setIcon(icon != null ? icon : null);
            menu.add(item);
            item.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                Program[] programs = collectProgramsFromNode(node);
                if ((programs != null) && (programs.length > 0)) {
                  plugin.receivePrograms(programs, ProgramReceiveTarget.createDefaultTargetForProgramReceiveIfId(plugin.getId()));
                }
              }
            });
          } else if (targets.length == 1 && (!(o instanceof ProgramReceiveTarget) || !o.equals(targets[0]))) {
            JMenuItem item = new JMenuItem(targets[0].toString());
            item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);

            Icon icon = plugin.getPluginIcon();

            item.setIcon(icon != null ? icon : null);
            menu.add(item);

            final ProgramReceiveTarget target = targets[0];

            item.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                Program[] programs = collectProgramsFromNode(node);
                if ((programs != null) && (programs.length > 0)) {
                  plugin.receivePrograms(programs, target);
                }
              }
            });
          } else if (targets.length >= 1) {
            JMenu subMenu = new JMenu(plugin.getInfo().getName());
            subMenu.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);

            Icon icon = plugin.getPluginIcon();

            subMenu.setIcon(icon != null ? icon : null);
            menu.add(subMenu);

            for (final ProgramReceiveTarget target : targets) {
              if (o == null || !o.equals(target)) {
                JMenuItem item = new JMenuItem(target.toString());
                item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
                subMenu.add(item);

                item.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {
                    Program[] programs = collectProgramsFromNode(node);
                    if ((programs != null) && (programs.length > 0)) {
                      plugin.receivePrograms(programs, target);
                    }
View Full Code Here

        }
      }
    };
    action.putValue(Action.NAME, mLocalizer.msg("filter","Show only contained programs"));

    JMenuItem item = new JMenuItem(action);
    item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);
    item.setIcon(TVBrowserIcons.filter(TVBrowserIcons.SIZE_SMALL));
    return item;
  }
View Full Code Here

    mPath = path;
  }

  public JPopupMenu getPopupMenu() {
    JPopupMenu menu = new JPopupMenu();
    JMenuItem item = new JMenuItem(mDefaultAction);
    item.setFont(MenuUtil.CONTEXT_MENU_BOLDFONT);
    menu.add(item);
    menu.add(getExpandAllMenuItem(mPath));
    menu.add(getFilterMenuItem(mPath));
    menu.add(getExportMenu( mPath));
    return menu;
View Full Code Here

    this.copyPopupMenu = new JPopupMenu();

    final String label = bundleSupport.getString("system-properties-panel.popup-menu.copy");
    final KeyStroke accelerator = bundleSupport.getKeyStroke("system-properties-panel.popup-menu.copy.accelerator");

    final JMenuItem copyMenuItem = new JMenuItem(label);
    copyMenuItem.setAccelerator(accelerator);
    copyMenuItem.getAccessibleContext().setAccessibleDescription(label);
    copyMenuItem.addActionListener(new CopyAction());
    this.copyPopupMenu.add(copyMenuItem);

    // add popup Listener to the table
    final PopupListener copyPopupListener = new PopupListener();
    this.table.addMouseListener(copyPopupListener);
View Full Code Here

    }

    public List getItemsForOMGraphicMenu(OMGraphic omg) {
        Debug.output("getMenuFor(" + omg.getClass().getName() + ")");
        List list = new LinkedList();
        list.add(new JMenuItem(omg.getClass().getName()));
        return list;
    }
View Full Code Here

TOP

Related Classes of javax.swing.JMenuItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.