Package javax.swing

Examples of javax.swing.JMenu


public class DefaultMenuBar extends MenuBar {

  public DefaultMenuBar(final MainFrame mainFrame, final JLabel label) {
    super(mainFrame, label);

    JMenu fileMenu = createMenu("menu.main", "&File");
    add(fileMenu);
    fileMenu.add(mQuitMI);

    createCommonMenus();

    mHelpMenu.addSeparator();
    mHelpMenu.add(mAboutMI);
View Full Code Here


    }
    resultListMenu.add(visTree);

   
    // visualization plugins
    JMenu visPlugins = new JMenu("Plugins");
    boolean availablePlugins = false;
   
    // trees
    if (grph != null) {
      // trees
      Vector pluginsVector = GenericObjectEditor.getClassnames(TreeVisualizePlugin.class.getName());
      for (int i = 0; i < pluginsVector.size(); i++) {
  String className = (String) (pluginsVector.elementAt(i));
  try {
    TreeVisualizePlugin plugin = (TreeVisualizePlugin) Class.forName(className).newInstance();
    if (plugin == null)
      continue;
    availablePlugins = true;
    JMenuItem pluginMenuItem = plugin.getVisualizeMenuItem(grph, selectedName);
    Version version = new Version();
    if (pluginMenuItem != null) {
      if (version.compareTo(plugin.getMinVersion()) < 0)
        pluginMenuItem.setText(pluginMenuItem.getText() + " (weka outdated)");
      if (version.compareTo(plugin.getMaxVersion()) >= 0)
        pluginMenuItem.setText(pluginMenuItem.getText() + " (plugin outdated)");
      visPlugins.add(pluginMenuItem);
    }
  }
  catch (Exception e) {
    //e.printStackTrace();
  }
View Full Code Here

    update();
    mMenu.show(mComponent, x, y);
  }

  protected static JMenu getSubMenu() {
    JMenu menu = new JMenu(mLocalizer.msg("toolbar", "Toolbar"));
    menu.add(createViewMenu());
    if(Settings.propIsToolbarVisible.getBoolean()) {
      menu.add(createViewSearchMenu());
    }
    menu.addSeparator();
    menu.add(createConfigureItem());

    return menu;
  }
View Full Code Here

  private void setMainframeMenusEnabled(boolean enabled) {
    JMenuBar bar = MainFrame.getInstance().getJMenuBar();

    for (int i = 0; i < bar.getMenuCount(); i++) {
      JMenu menu = bar.getMenu(i);
      if (menu != null) {
        menu.setEnabled(enabled);
      }
    }
  }
View Full Code Here

          if (webPlugin != null && webPlugin.canReceiveProgramsWithTarget()) {
            ProgramReceiveTarget[] targets = webPlugin
                .getProgramReceiveTargets();

            if (targets != null && targets.length > 0) {
              final JMenu subMenu = new JMenu(webPlugin.getInfo().getName());
              subMenu.setIcon(webPlugin.getMarkIcon());
              popupMenu.add(subMenu);

              for (final ProgramReceiveTarget target : targets) {
                item = new JMenuItem(target.toString());
                item.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {
                    searchWebPlugin(searchText, target);
                  }
                });

                if (value.endsWith(target.getTargetId())) {
                  item.setFont(item.getFont().deriveFont(Font.BOLD));
                }

                subMenu.add(item);
              }
            }
          }

          popupMenu.addSeparator();
          popupMenu.add(addFavoriteMenuItem(searchText, actorFavorite));
          popupMenu.addSeparator();
        }
        JMenu subMenu = ContextMenuManager.getInstance()
            .createContextMenuItems(ProgramInfoProxy.getInstance(), mProgram,
                true);
        subMenu.setText(Localizer.getLocalization(Localizer.I18N_PROGRAM));
        popupMenu.add(subMenu);
        return popupMenu;
      }

      private void handleEvent(MouseEvent e, boolean popupEvent) {
View Full Code Here

   * @return a context menu for the given program.
   */

  public static JPopupMenu createPluginContextMenu(Program program, ContextMenuIf menuIf) {
    JPopupMenu menu = new JPopupMenu();
    JMenu menus = ContextMenuManager.getInstance().createContextMenuItems(menuIf, program, true);

    Component[] comps = menus.getMenuComponents();
    for (Component component : comps) {
      menu.add(component);
    }

    return menu;
View Full Code Here

     return menu;
  }

  protected JMenu createMenu(final String localizerKey,
      final String defaultLabel) {
    JMenu menu = new JMenu();
    setLabelAndAccessKeys(localizerKey, defaultLabel, menu, false);
    return menu;
  }
View Full Code Here

    result[0].setSelected(true);
    return result;
  }

  private JMenu createLicenseMenuItems() {
    JMenu licenseMenu = new JMenu();
    TvDataServiceProxy[] services = TvDataServiceProxyManager.getInstance()
        .getDataServices();
    for (TvDataServiceProxy service : services) {
      final String license = service.getInfo().getLicense();
      if (license != null) {
        String name = service.getInfo().getName();
        JMenuItem item = new JMenuItem(name, new ImageIcon(
            "imgs/tvbrowser16.png"));
        setMnemonic(item);
        item.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            LicenseBox box = new LicenseBox(mMainFrame, license, false);
            util.ui.UiUtilities.centerAndShow(box);
          }
        });
        licenseMenu.add(item);
      }
    }
    if (licenseMenu.getItemCount() > 1) {
      setLabelAndAccessKeys("menuitem.licenseMultiple", "Terms of Use",
          licenseMenu, false);
    } else {
      setLabelAndAccessKeys("menuitem.license", "Terms of Use", licenseMenu,
          true);
View Full Code Here

  protected void createCommonMenus() {
    add(mViewMenu);

    add(mGoMenu);

    JMenu tvListingsMenu = createMenu("menu.tvData", "TV &data");
    add(tvListingsMenu);
    tvListingsMenu.add(createMenuItem(TVBrowserActions.update));
    tvListingsMenu.add(createMenuItem(TVBrowserActions.configureChannels));
    tvListingsMenu.addSeparator();
    tvListingsMenu.add(mLicenseMenu);

    mPluginsMenu = createMenu("menu.plugins", "&Tools");
    add(mPluginsMenu);
    updatePluginsMenu();
View Full Code Here

      }

      if (Settings.propTraySoonProgramsEnabled.getBoolean()
          && (!nextPrograms.isEmpty() || !nextAdditionalPrograms.isEmpty())) {

        final JMenu next = new ScrollableMenu(now ? mLocalizer.msg("menu.programsSoon", "Soon runs") : mLocalizer.msg(
            "menu.programsSoonAlone", "Soon runs"));

        addMenuItems(next, nextPrograms);
        addMenuItems(next, nextAdditionalPrograms);
        addNoProgramsItem(next);
View Full Code Here

TOP

Related Classes of javax.swing.JMenu

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.