Java JFrame setWindowListenerDispose(JFrame frame)

Here you can find the source of setWindowListenerDispose(JFrame frame)

Description

set Window Listener Dispose

License

Open Source License

Declaration

public static void setWindowListenerDispose(JFrame frame) 

Method Source Code


//package com.java2s;
import javax.swing.JFrame;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class Main {
    public static void setWindowListenerDispose(JFrame frame) {
        frame.addWindowListener(new WindowAdapter() {

            public void windowClosing(WindowEvent evt) {
                evt.getWindow().dispose();
            }//from  w  w  w  . java 2s. c  om

        });
    }
}

Related

  1. setInfo(String info, JFrame root)
  2. setJFrameAlwaysOnTop(JFrame frame, boolean newValue)
  3. setMainWindowLocation(JFrame jfrm, String strPropertiesFilePath, String strPropertiesFileName)
  4. setPanel(JPanel parent, JPanel child, JFrame f)
  5. setPersistentExtendedStateMask(JFrame frame, int persistentExtendedStateMask)
  6. setWindowRightSide(final JFrame frame)
  7. setWinVisible(final JFrame win, final boolean vis)
  8. smartSetBounds(JFrame frame)
  9. staggerOpenedFrames(List frames)