src/share/classes/javax/swing/JDialog.java

Print this page




  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javax.swing;
  26 
  27 import java.awt.*;
  28 import java.awt.event.*;
  29 import javax.accessibility.*;
  30 
  31 /**
  32  * The main class for creating a dialog window. You can use this class
  33  * to create a custom dialog, or invoke the many class methods
  34  * in {@link JOptionPane} to create a variety of standard dialogs.
  35  * For information about creating dialogs, see
  36  * <em>The Java Tutorial</em> section
  37  * <a
  38  href="http://java.sun.com/docs/books/tutorial/uiswing/components/dialog.html">How
  39  * to Make Dialogs</a>.
  40  *
  41  * <p>
  42  *
  43  * The {@code JDialog} component contains a {@code JRootPane}
  44  * as its only child.
  45  * The {@code contentPane} should be the parent of any children of the
  46  * {@code JDialog}.
  47  * As a convenience {@code add} and its variants, {@code remove} and
  48  * {@code setLayout} have been overridden to forward to the
  49  * {@code contentPane} as necessary. This means you can write:
  50  * <pre>
  51  *       dialog.add(child);
  52  * </pre>
  53  * And the child will be added to the contentPane.
  54  * The {@code contentPane} is always non-{@code null}.
  55  * Attempting to set it to {@code null} generates an exception.
  56  * The default {@code contentPane} has a {@code BorderLayout}
  57  * manager set on it.
  58  * Refer to {@link javax.swing.RootPaneContainer}


 769         return defaultCloseOperation;
 770     }
 771 
 772     /**
 773      * Sets the {@code transferHandler} property, which is a mechanism to
 774      * support transfer of data into this component. Use {@code null}
 775      * if the component does not support data transfer operations.
 776      * <p>
 777      * If the system property {@code suppressSwingDropSupport} is {@code false}
 778      * (the default) and the current drop target on this component is either
 779      * {@code null} or not a user-set drop target, this method will change the
 780      * drop target as follows: If {@code newHandler} is {@code null} it will
 781      * clear the drop target. If not {@code null} it will install a new
 782      * {@code DropTarget}.
 783      * <p>
 784      * Note: When used with {@code JDialog}, {@code TransferHandler} only
 785      * provides data import capability, as the data export related methods
 786      * are currently typed to {@code JComponent}.
 787      * <p>
 788      * Please see
 789      * <a href="http://java.sun.com/docs/books/tutorial/uiswing/misc/dnd.html">
 790      * How to Use Drag and Drop and Data Transfer</a>, a section in
 791      * <em>The Java Tutorial</em>, for more information.
 792      *
 793      * @param newHandler the new {@code TransferHandler}
 794      *
 795      * @see TransferHandler
 796      * @see #getTransferHandler
 797      * @see java.awt.Component#setDropTarget
 798      * @since 1.6
 799      *
 800      * @beaninfo
 801      *        bound: true
 802      *       hidden: true
 803      *  description: Mechanism for transfer of data into the component
 804      */
 805     public void setTransferHandler(TransferHandler newHandler) {
 806         TransferHandler oldHandler = transferHandler;
 807         transferHandler = newHandler;
 808         SwingUtilities.installSwingDropTargetAsNecessary(this, transferHandler);
 809         firePropertyChange("transferHandler", oldHandler, newHandler);




  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javax.swing;
  26 
  27 import java.awt.*;
  28 import java.awt.event.*;
  29 import javax.accessibility.*;
  30 
  31 /**
  32  * The main class for creating a dialog window. You can use this class
  33  * to create a custom dialog, or invoke the many class methods
  34  * in {@link JOptionPane} to create a variety of standard dialogs.
  35  * For information about creating dialogs, see
  36  * <em>The Java Tutorial</em> section
  37  * <a
  38  href="http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html">How
  39  * to Make Dialogs</a>.
  40  *
  41  * <p>
  42  *
  43  * The {@code JDialog} component contains a {@code JRootPane}
  44  * as its only child.
  45  * The {@code contentPane} should be the parent of any children of the
  46  * {@code JDialog}.
  47  * As a convenience {@code add} and its variants, {@code remove} and
  48  * {@code setLayout} have been overridden to forward to the
  49  * {@code contentPane} as necessary. This means you can write:
  50  * <pre>
  51  *       dialog.add(child);
  52  * </pre>
  53  * And the child will be added to the contentPane.
  54  * The {@code contentPane} is always non-{@code null}.
  55  * Attempting to set it to {@code null} generates an exception.
  56  * The default {@code contentPane} has a {@code BorderLayout}
  57  * manager set on it.
  58  * Refer to {@link javax.swing.RootPaneContainer}


 769         return defaultCloseOperation;
 770     }
 771 
 772     /**
 773      * Sets the {@code transferHandler} property, which is a mechanism to
 774      * support transfer of data into this component. Use {@code null}
 775      * if the component does not support data transfer operations.
 776      * <p>
 777      * If the system property {@code suppressSwingDropSupport} is {@code false}
 778      * (the default) and the current drop target on this component is either
 779      * {@code null} or not a user-set drop target, this method will change the
 780      * drop target as follows: If {@code newHandler} is {@code null} it will
 781      * clear the drop target. If not {@code null} it will install a new
 782      * {@code DropTarget}.
 783      * <p>
 784      * Note: When used with {@code JDialog}, {@code TransferHandler} only
 785      * provides data import capability, as the data export related methods
 786      * are currently typed to {@code JComponent}.
 787      * <p>
 788      * Please see
 789      * <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
 790      * How to Use Drag and Drop and Data Transfer</a>, a section in
 791      * <em>The Java Tutorial</em>, for more information.
 792      *
 793      * @param newHandler the new {@code TransferHandler}
 794      *
 795      * @see TransferHandler
 796      * @see #getTransferHandler
 797      * @see java.awt.Component#setDropTarget
 798      * @since 1.6
 799      *
 800      * @beaninfo
 801      *        bound: true
 802      *       hidden: true
 803      *  description: Mechanism for transfer of data into the component
 804      */
 805     public void setTransferHandler(TransferHandler newHandler) {
 806         TransferHandler oldHandler = transferHandler;
 807         transferHandler = newHandler;
 808         SwingUtilities.installSwingDropTargetAsNecessary(this, transferHandler);
 809         firePropertyChange("transferHandler", oldHandler, newHandler);