⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jdialog.java

📁 gcc的组建
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* JDialog.java --   Copyright (C) 2002, 2004 Free Software Foundation, Inc.This file is part of GNU Classpath.GNU Classpath is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU Classpath is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Classpath; see the file COPYING.  If not, write to theFree Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA02110-1301 USA.Linking this library statically or dynamically with other modules ismaking a combined work based on this library.  Thus, the terms andconditions of the GNU General Public License cover the wholecombination.As a special exception, the copyright holders of this library give youpermission to link this library with independent modules to produce anexecutable, regardless of the license terms of these independentmodules, and to copy and distribute the resulting executable underterms of your choice, provided that you also meet, for each linkedindependent module, the terms and conditions of the license of thatmodule.  An independent module is a module which is not derived fromor based on this library.  If you modify this library, you may extendthis exception to your version of the library, but you are notobligated to do so.  If you do not wish to do so, delete thisexception statement from your version. */package javax.swing;import java.awt.Component;import java.awt.Container;import java.awt.Dialog;import java.awt.Dimension;import java.awt.Frame;import java.awt.Graphics;import java.awt.GraphicsConfiguration;import java.awt.IllegalComponentStateException;import java.awt.LayoutManager;import java.awt.event.WindowEvent;import javax.accessibility.Accessible;import javax.accessibility.AccessibleContext;/** * A dialog window. This is an extension of {@link java.awt.Dialog} that * provides support for the Swing architecture. Most importantly it contains a * {@link JRootPane} as it's only top-level child, that manages the content * pane, the menu and a glass pane. * * Also, unlike <code>java.awt.Dialog</code>s, JDialogs support the * Swing Pluggable Look &amp; Feel architecture. *  * @author Ronald Veldema (rveldema@cs.vu.nl) */public class JDialog extends Dialog implements Accessible, WindowConstants,                                               RootPaneContainer{  /**   * Provides accessibility support for <code>JDialog</code>s.   */  protected class AccessibleJDialog extends Dialog.AccessibleAWTDialog  {    /**     * Creates a new instance of <code>AccessibleJDialog</code>.     */    public AccessibleJDialog()    {      super();      // Nothing to do here.    }  }  private static final long serialVersionUID = -864070866424508218L;  /** DOCUMENT ME! */  protected AccessibleContext accessibleContext;  /** The single RootPane in the Dialog. */  protected JRootPane rootPane;  /**   * Whether checking is enabled on the RootPane.   *   * @specnote Should be false to comply with J2SE 5.0   */   protected boolean rootPaneCheckingEnabled = false;  /** The default action taken when closed. */  private int close_action = HIDE_ON_CLOSE;    /** Whether JDialogs are decorated by the Look and Feel. */  private static boolean decorated;  /* Creates a new non-modal JDialog with no title    * using a shared Frame as the owner.   */  public JDialog()  {    this(SwingUtilities.getOwnerFrame(), "", false, null);  }  /**   * Creates a new non-modal JDialog with no title   * using the given owner.   *   * @param owner The owner of the JDialog.   */  public JDialog(Dialog owner)  {    this(owner, "", false, null);  }  /**   * Creates a new JDialog with no title using the   * given modal setting and owner.   *   * @param owner The owner of the JDialog.   * @param modal Whether the JDialog is modal.   */  public JDialog(Dialog owner, boolean modal)  {    this(owner, "", modal, null);  }  /**   * Creates a new non-modal JDialog using the    * given title and owner.   *   * @param owner The owner of the JDialog.   * @param title The title of the JDialog.   */  public JDialog(Dialog owner, String title)  {    this(owner, title, false, null);  }  /**   * Creates a new JDialog using the given modal    * settings, title, and owner.   *   * @param owner The owner of the JDialog.   * @param title The title of the JDialog.   * @param modal Whether the JDialog is modal.   */  public JDialog(Dialog owner, String title, boolean modal)  {    this(owner, title, modal, null);  }  /**   * Creates a new JDialog using the given modal    * settings, title, owner and graphics configuration.   *   * @param owner The owner of the JDialog.   * @param title The title of the JDialog.   * @param modal Whether the JDialog is modal.   * @param gc The Graphics Configuration to use.   */  public JDialog(Dialog owner, String title, boolean modal,                 GraphicsConfiguration gc)  {    super(owner, title, modal, gc);    dialogInit();  }  /**   * Creates a new non-modal JDialog with no title   * using the given owner.   *   * @param owner The owner of the JDialog.   */  public JDialog(Frame owner)  {    this(owner, "", false, null);  }  /**   * Creates a new JDialog with no title using the   * given modal setting and owner.   *   * @param owner The owner of the JDialog.   * @param modal Whether the JDialog is modal.   */  public JDialog(Frame owner, boolean modal)  {    this(owner, "", modal, null);  }  /**   * Creates a new non-modal JDialog using the    * given title and owner.   *   * @param owner The owner of the JDialog.   * @param title The title of the JDialog.   */  public JDialog(Frame owner, String title)  {    this(owner, title, false, null);  }  /**   * Creates a new JDialog using the given modal    * settings, title, and owner.   *   * @param owner The owner of the JDialog.   * @param title The title of the JDialog.   * @param modal Whether the JDialog is modal.   */  public JDialog(Frame owner, String title, boolean modal)  {    this(owner, title, modal, null);  }  /**   * Creates a new JDialog using the given modal    * settings, title, owner and graphics configuration.   *   * @param owner The owner of the JDialog.   * @param title The title of the JDialog.   * @param modal Whether the JDialog is modal.   * @param gc The Graphics Configuration to use.   */  public JDialog(Frame owner, String title, boolean modal,                 GraphicsConfiguration gc)  {    super((owner == null) ? SwingUtilities.getOwnerFrame() : owner,           title, modal, gc);    dialogInit();  }  /**   * This method is called to initialize the    * JDialog. It sets the layout used, the locale,    * and creates the RootPane.   */  protected void dialogInit()  {    // FIXME: Do a check on GraphicsEnvironment.isHeadless()    setLocale(JComponent.getDefaultLocale());    getRootPane(); // Will do set/create.    invalidate();    // Now that initStageDone is true, adds and layouts apply to contentPane,    // not top-level.    setRootPaneCheckingEnabled(true);  }  /**   * This method returns whether JDialogs will have their   * window decorations provided by the Look and Feel.   *   * @return Whether the window decorations are Look and Feel provided.   */  public static boolean isDefaultLookAndFeelDecorated()  {    return decorated;  }  /**   * This method sets whether JDialogs will have their   * window decorations provided by the Look and Feel.   *   * @param defaultLookAndFeelDecorated Whether the window   * decorations are Look and Feel provided.   */  public static void setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated)  {    decorated = defaultLookAndFeelDecorated;  }  /**   * This method returns the preferred size of    * the JDialog.   *   * @return The preferred size.   */  public Dimension getPreferredSize()  {    Dimension d = super.getPreferredSize();    return d;  }  /**   * This method returns the JMenuBar used   * in this JDialog.   *   * @return The JMenuBar in the JDialog.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -