jdk/src/java.desktop/share/classes/javax/swing/JFrame.java
changeset 26037 508779ce6619
parent 26028 2ee7c47e175a
parent 25859 3317bb8137f4
child 28231 b608ffcaed74
equal deleted inserted replaced
25992:e9b05e933ddd 26037:508779ce6619
    22  * or visit www.oracle.com if you need additional information or have any
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 package javax.swing;
    25 package javax.swing;
    26 
    26 
    27 import java.awt.*;
    27 import java.awt.AWTEvent;
    28 import java.awt.event.*;
    28 import java.awt.BorderLayout;
    29 import java.beans.PropertyChangeListener;
    29 import java.awt.Component;
    30 import java.util.Locale;
    30 import java.awt.Container;
    31 import java.util.Vector;
    31 import java.awt.Frame;
    32 import java.io.Serializable;
    32 import java.awt.Graphics;
    33 
    33 import java.awt.GraphicsConfiguration;
    34 import javax.accessibility.*;
    34 import java.awt.HeadlessException;
       
    35 import java.awt.Image;
       
    36 import java.awt.LayoutManager;
       
    37 import java.awt.event.WindowEvent;
       
    38 
       
    39 import javax.accessibility.Accessible;
       
    40 import javax.accessibility.AccessibleContext;
       
    41 import javax.accessibility.AccessibleState;
       
    42 import javax.accessibility.AccessibleStateSet;
    35 
    43 
    36 
    44 
    37 /**
    45 /**
    38  * An extended version of <code>java.awt.Frame</code> that adds support for
    46  * An extended version of <code>java.awt.Frame</code> that adds support for
    39  * the JFC/Swing component architecture.
    47  * the JFC/Swing component architecture.
   295      *
   303      *
   296      * @param  e  the window event
   304      * @param  e  the window event
   297      * @see    #setDefaultCloseOperation
   305      * @see    #setDefaultCloseOperation
   298      * @see    java.awt.Window#processWindowEvent
   306      * @see    java.awt.Window#processWindowEvent
   299      */
   307      */
   300     protected void processWindowEvent(WindowEvent e) {
   308     protected void processWindowEvent(final WindowEvent e) {
   301         super.processWindowEvent(e);
   309         super.processWindowEvent(e);
   302 
   310 
   303         if (e.getID() == WindowEvent.WINDOW_CLOSING) {
   311         if (e.getID() == WindowEvent.WINDOW_CLOSING) {
   304             switch(defaultCloseOperation) {
   312             switch (defaultCloseOperation) {
   305               case HIDE_ON_CLOSE:
   313                 case HIDE_ON_CLOSE:
   306                  setVisible(false);
   314                     setVisible(false);
   307                  break;
   315                     break;
   308               case DISPOSE_ON_CLOSE:
   316                 case DISPOSE_ON_CLOSE:
   309                  dispose();
   317                     dispose();
   310                  break;
   318                     break;
   311               case DO_NOTHING_ON_CLOSE:
   319                 case EXIT_ON_CLOSE:
   312                  default:
   320                     // This needs to match the checkExit call in
   313                  break;
   321                     // setDefaultCloseOperation
   314               case EXIT_ON_CLOSE:
   322                     System.exit(0);
   315                   // This needs to match the checkExit call in
   323                     break;
   316                   // setDefaultCloseOperation
   324                 case DO_NOTHING_ON_CLOSE:
   317                 System.exit(0);
   325                 default:
   318                 break;
       
   319             }
   326             }
   320         }
   327         }
   321     }
   328     }
   322 
       
   323 //    public void setMenuBar(MenuBar menu) {
       
   324 //        throw new IllegalComponentStateException("Please use setJMenuBar() with JFrame.");
       
   325 //    }
       
   326 
   329 
   327     /**
   330     /**
   328      * Sets the operation that will happen by default when
   331      * Sets the operation that will happen by default when
   329      * the user initiates a "close" on this frame.
   332      * the user initiates a "close" on this frame.
   330      * You must specify one of the following choices:
   333      * You must specify one of the following choices: