Java JButton exit(JButton aButton)

Here you can find the source of exit(JButton aButton)

Description

exit

License

Open Source License

Declaration

public static void exit(JButton aButton) 

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 a2s.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. drawCharacter(JPanel contentPane, ActionListener listener, String url, int x, int y, List buttons)
  2. enableEnter(JButton b)
  3. ensureButtonWidth(JButton button, int width)
  4. enterPressesWhenFocused(final JButton button)
  5. equalizeButtons(JButton... buttons)
  6. fixButtonWidth(JButton... buttons)
  7. fixToolbarButtonImpl(JButton button)
  8. formatButtonAsLabel(JButton button)
  9. formatJButton(JButton button, String tooltips)