Java JMenuItem exit(JMenuItem anItem)

Here you can find the source of exit(JMenuItem anItem)

Description

exit

License

Open Source License

Declaration

public static void exit(JMenuItem anItem) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JMenuItem;

public class Main {
    public static void exit(JButton aButton) {
        aButton.addActionListener(new ActionListener() {
            @Override//from w w  w  .  j  a v  a 2 s.  c  o m
            public void actionPerformed(ActionEvent event) {
                System.exit(0);
            }
        });
    }

    public static void exit(JMenuItem anItem) {
        anItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent event) {
                System.exit(0);
            }
        });
    }
}

Related

  1. cloneMenuItem(final JMenuItem item)
  2. configureMenuItem(JMenuItem item, Action action)
  3. createJMenuItem(Action action)
  4. createJMenuItem(JMenu menu, String text, int mnemonic, int acceleratorKey, String toolTip, ActionListener actionListener)
  5. createMenu(JMenuItem[] items, String name, String description, int mnemonic)
  6. getForeground(final BasicMenuItemUI ui, final JMenuItem menuItem)
  7. getIconPlaceholderWidth(final JMenuItem menuItem, final boolean alignTextToMenuIcons)
  8. getInvoker(final JMenuItem menuItem)
  9. getJMenuItem(String name, JMenuBar jmenubar)