Package javax.swing

Examples of javax.swing.JMenuItem


    if (!x && getComponentCount() > 0) { remove(getComponentCount() - 1); }
  }
 
  private boolean add(LogisimMenuItem item, String display) {
    if (shouldShow(item)) {
      JMenuItem menu = new JMenuItem(display);
      items.put(item, menu);
      menu.setEnabled(isEnabled(item));
      menu.addActionListener(listener);
      add(menu);
      return true;
    } else {
      return false;
    }
View Full Code Here


    public void configureMenu(JPopupMenu menu, Project proj) {
      this.proj = proj;
      String name = instance.getFactory().getDisplayName();
      String text = Strings.get("subcircuitViewItem", name);
      JMenuItem item = new JMenuItem(text);
      item.addActionListener(this);
      menu.add(item);
    }
View Full Code Here

    menu.add(load);
    menu.add(save);
  }

  private JMenuItem createItem(boolean enabled, String label) {
    JMenuItem ret = new JMenuItem(label);
    ret.setEnabled(enabled);
    ret.addActionListener(this);
    return ret;
  }
View Full Code Here

  public void insert(String s, int pos) {
    if (pos < 0) {
      throw new IllegalArgumentException("index less than zero.");
    }

    insert(new JMenuItem(s), pos);

  }
View Full Code Here

  public JMenuItem insert(Action a, int pos) {
    if (pos < 0) {
      throw new IllegalArgumentException("index less than zero.");
    }

    JMenuItem menuItem = new JMenuItem((String) a.getValue(Action.NAME), (Icon) a.getValue(Action.SMALL_ICON));
    menuItem.setHorizontalTextPosition(SwingConstants.TRAILING);
    menuItem.setVerticalTextPosition(SwingConstants.CENTER);
    menuItem.setEnabled(a.isEnabled());
    menuItem.setAction(a);
    insert(menuItem, pos);

    return menuItem;
  }
View Full Code Here

  public JMenuItem getItem(int pos) {
    if (pos < 0) {
      throw new IllegalArgumentException("index less than zero.");
    }

    JMenuItem menuItem = null;

    Component component = getMenuComponent(pos);
    if (component instanceof JMenuItem) {
      menuItem = (JMenuItem) component;
    }
View Full Code Here

  /**
   * Init the session menu.
   */
  private void initSessionMenu() {
    sessionMenu = new JMenu(this.properties.getValue("sessionMenu"));
    JMenuItem openSession = new JMenuItem(properties.getValue("openSession"));
    JMenuItem closeSession = new JMenuItem(properties.getValue("closeSession"));
    JMenuItem exit = new JMenuItem(properties.getValue("exit"));

    exit.addActionListener(new QuitAppli());
    closeSession.addActionListener(new CloseSession());
    //this.sessionMenu.add(openSession);
    this.sessionMenu.add(closeSession);
    this.sessionMenu.add(exit);

View Full Code Here

  /**
   * Init the option menu.
   */
  private void initOptionsMenu() {
    optionsMenu = new JMenu(this.properties.getValue("optionsMenu"));
    JMenuItem options = new JMenuItem(properties.getValue("options"));
    JMenuItem help = new JMenuItem(properties.getValue("help"));
    JMenuItem about = new JMenuItem(properties.getValue("about"));

    options.addActionListener(new SetOptions(this.properties, MainFrame.myRef));
    help.addActionListener(new LaunchHelp());
    about.addActionListener(new AboutHamsam());

    this.optionsMenu.add(options);
    this.optionsMenu.add(help);
    this.optionsMenu.add(about);

View Full Code Here

    mSource = src;
    mChannel = ch;
    mComponent = e.getComponent();

    mMenu = new JPopupMenu();
    mChAdd = new JMenuItem(mLocalizer.msg("addChannels", "Add/Remove channels"));
    mChConf = new JMenuItem(mLocalizer.msg("configChannel", "Setup channel"),
        TVBrowserIcons.edit(TVBrowserIcons.SIZE_SMALL));
    mChGoToURL = new JMenuItem(mLocalizer.msg("openURL", "Open internet page"),
        IconLoader.getInstance().getIconFromTheme("apps",
            "internet-web-browser"));

    // dynamically create filters from available channel filter components
    mFilterChannels = new JMenu(mLocalizer.msg("filterChannels",
View Full Code Here

    frmEverbox.setJMenuBar(menuBar);
   
    JMenu FileMenu = new JMenu("File");
    menuBar.add(FileMenu);
   
    JMenuItem ExitMenuItem = new JMenuItem("\u9000\u51FA");
    ExitMenuItem.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        client.run = false;
        stopClientButton.setText("正在关闭,请等候");
        while(true) {
          if(clientThread.isAlive())
            try {
              Thread.sleep(1000);
            } catch (Throwable e1) {
            }
          break;
        }
        frmEverbox.dispose();
      }
    });
    FileMenu.add(ExitMenuItem);
   
    JMenu cleanMenu = new JMenu("\u6E05\u7406");
    menuBar.add(cleanMenu);
   
    JMenuItem mntmNewMenuItem = new JMenuItem("\u6E05\u7406\u767B\u9646\u4FE1\u606F");
    mntmNewMenuItem.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        File f = new File("everbox.data");
        if(f.exists())
          f.delete();
      }
    });
    mntmNewMenuItem.setEnabled(false);
    cleanMenu.add(mntmNewMenuItem);
   
    JMenuItem mntmNewMenuItem_1 = new JMenuItem("\u6E05\u7406\u65E5\u5FD7\u4FE1\u606F");
    mntmNewMenuItem_1.setEnabled(false);
    cleanMenu.add(mntmNewMenuItem_1);
   
    JMenuItem mntmNewMenuItem_3 = new JMenuItem("\u6E05\u7406\u4E0B\u8F7D\u7528\u5230\u7684\u4E34\u65F6\u6587\u4EF6");
    mntmNewMenuItem_3.setEnabled(false);
    cleanMenu.add(mntmNewMenuItem_3);
   
    JMenuItem mntmNewMenuItem_4 = new JMenuItem("\u6E05\u7406\u6587\u4EF6\u6570\u636E\u5E93");
    mntmNewMenuItem_4.setEnabled(false);
    cleanMenu.add(mntmNewMenuItem_4);
   
    JMenu helpMenu = new JMenu("\u5E2E\u52A9");
    menuBar.add(helpMenu);
   
    JMenuItem vistHomepageMenuItem = new JMenuItem("\u8BBF\u95EE\u9879\u76EE\u9996\u9875");
    vistHomepageMenuItem.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        try {
          Desktop.getDesktop().browse(new URL("http://everbox4j.googlecode.com").toURI());
        } catch (Throwable e2) {
          log.warn("启动浏览器失败!!",e2);
          JOptionPane.showConfirmDialog(frmEverbox, "启动浏览器失败!! http://everbox4j.googlecode.com");
        }
      }
    });
    helpMenu.add(vistHomepageMenuItem);
   
    JMenuItem sendMailFeedback = new JMenuItem("\u610F\u89C1\u53CD\u9988(\u53D1\u9001\u90AE\u4EF6)");
    sendMailFeedback.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        try {
          Desktop.getDesktop().mail(new URL("everbox4j@wendal.net").toURI());
        } catch (Throwable e2) {
          log.warn("启动邮件客户端失败!!",e2);
          JOptionPane.showConfirmDialog(frmEverbox, "启动邮件客户端失败!! 反馈邮箱: everbox4j@wendal.net");
        }
      }
    });
    helpMenu.add(sendMailFeedback);
   
    JMenuItem aboutMenuItem = new JMenuItem("\u5173\u4E8E...");
    aboutMenuItem.setEnabled(false);
    helpMenu.add(aboutMenuItem);
   
    JPanel clientContrlPanel = new JPanel();
    frmEverbox.getContentPane().add(clientContrlPanel, BorderLayout.NORTH);
   
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.