23 * questions.
24 */
25 package javax.swing;
26
27 import java.awt.*;
28 import java.awt.event.*;
29 import java.applet.Applet;
30 import java.beans.PropertyChangeListener;
31 import java.util.Locale;
32 import java.util.Vector;
33 import java.io.Serializable;
34 import javax.accessibility.*;
35
36 /**
37 * An extended version of <code>java.applet.Applet</code> that adds support for
38 * the JFC/Swing component architecture.
39 * You can find task-oriented documentation about using <code>JApplet</code>
40 * in <em>The Java Tutorial</em>,
41 * in the section
42 * <a
43 href="http://java.sun.com/docs/books/tutorial/uiswing/components/applet.html">How to Make Applets</a>.
44 * <p>
45 * The <code>JApplet</code> class is slightly incompatible with
46 * <code>java.applet.Applet</code>. <code>JApplet</code> contains a
47 * <code>JRootPane</code> as its only child. The <code>contentPane</code>
48 * should be the parent of any children of the <code>JApplet</code>.
49 * As a convenience <code>add</code> and its variants, <code>remove</code> and
50 * <code>setLayout</code> have been overridden to forward to the
51 * <code>contentPane</code> as necessary. This means you can write:
52 * <pre>
53 * applet.add(child);
54 * </pre>
55 *
56 * And the child will be added to the <code>contentPane</code>.
57 * The <code>contentPane</code> will always be non-<code>null</code>.
58 * Attempting to set it to <code>null</code> will cause the
59 * <code>JApplet</code> to throw an exception. The default
60 * <code>contentPane</code> will have a <code>BorderLayout</code>
61 * manager set on it.
62 * Refer to {@link javax.swing.RootPaneContainer}
63 * for details on adding, removing and setting the <code>LayoutManager</code>
166 return rp;
167 }
168
169 /**
170 * Sets the {@code transferHandler} property, which is a mechanism to
171 * support transfer of data into this component. Use {@code null}
172 * if the component does not support data transfer operations.
173 * <p>
174 * If the system property {@code suppressSwingDropSupport} is {@code false}
175 * (the default) and the current drop target on this component is either
176 * {@code null} or not a user-set drop target, this method will change the
177 * drop target as follows: If {@code newHandler} is {@code null} it will
178 * clear the drop target. If not {@code null} it will install a new
179 * {@code DropTarget}.
180 * <p>
181 * Note: When used with {@code JApplet}, {@code TransferHandler} only
182 * provides data import capability, as the data export related methods
183 * are currently typed to {@code JComponent}.
184 * <p>
185 * Please see
186 * <a href="http://java.sun.com/docs/books/tutorial/uiswing/misc/dnd.html">
187 * How to Use Drag and Drop and Data Transfer</a>, a section in
188 * <em>The Java Tutorial</em>, for more information.
189 *
190 * @param newHandler the new {@code TransferHandler}
191 *
192 * @see TransferHandler
193 * @see #getTransferHandler
194 * @see java.awt.Component#setDropTarget
195 * @since 1.6
196 *
197 * @beaninfo
198 * bound: true
199 * hidden: true
200 * description: Mechanism for transfer of data into the component
201 */
202 public void setTransferHandler(TransferHandler newHandler) {
203 TransferHandler oldHandler = transferHandler;
204 transferHandler = newHandler;
205 SwingUtilities.installSwingDropTargetAsNecessary(this, transferHandler);
206 firePropertyChange("transferHandler", oldHandler, newHandler);
|
23 * questions.
24 */
25 package javax.swing;
26
27 import java.awt.*;
28 import java.awt.event.*;
29 import java.applet.Applet;
30 import java.beans.PropertyChangeListener;
31 import java.util.Locale;
32 import java.util.Vector;
33 import java.io.Serializable;
34 import javax.accessibility.*;
35
36 /**
37 * An extended version of <code>java.applet.Applet</code> that adds support for
38 * the JFC/Swing component architecture.
39 * You can find task-oriented documentation about using <code>JApplet</code>
40 * in <em>The Java Tutorial</em>,
41 * in the section
42 * <a
43 href="http://docs.oracle.com/javase/tutorial/uiswing/components/applet.html">How to Make Applets</a>.
44 * <p>
45 * The <code>JApplet</code> class is slightly incompatible with
46 * <code>java.applet.Applet</code>. <code>JApplet</code> contains a
47 * <code>JRootPane</code> as its only child. The <code>contentPane</code>
48 * should be the parent of any children of the <code>JApplet</code>.
49 * As a convenience <code>add</code> and its variants, <code>remove</code> and
50 * <code>setLayout</code> have been overridden to forward to the
51 * <code>contentPane</code> as necessary. This means you can write:
52 * <pre>
53 * applet.add(child);
54 * </pre>
55 *
56 * And the child will be added to the <code>contentPane</code>.
57 * The <code>contentPane</code> will always be non-<code>null</code>.
58 * Attempting to set it to <code>null</code> will cause the
59 * <code>JApplet</code> to throw an exception. The default
60 * <code>contentPane</code> will have a <code>BorderLayout</code>
61 * manager set on it.
62 * Refer to {@link javax.swing.RootPaneContainer}
63 * for details on adding, removing and setting the <code>LayoutManager</code>
166 return rp;
167 }
168
169 /**
170 * Sets the {@code transferHandler} property, which is a mechanism to
171 * support transfer of data into this component. Use {@code null}
172 * if the component does not support data transfer operations.
173 * <p>
174 * If the system property {@code suppressSwingDropSupport} is {@code false}
175 * (the default) and the current drop target on this component is either
176 * {@code null} or not a user-set drop target, this method will change the
177 * drop target as follows: If {@code newHandler} is {@code null} it will
178 * clear the drop target. If not {@code null} it will install a new
179 * {@code DropTarget}.
180 * <p>
181 * Note: When used with {@code JApplet}, {@code TransferHandler} only
182 * provides data import capability, as the data export related methods
183 * are currently typed to {@code JComponent}.
184 * <p>
185 * Please see
186 * <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
187 * How to Use Drag and Drop and Data Transfer</a>, a section in
188 * <em>The Java Tutorial</em>, for more information.
189 *
190 * @param newHandler the new {@code TransferHandler}
191 *
192 * @see TransferHandler
193 * @see #getTransferHandler
194 * @see java.awt.Component#setDropTarget
195 * @since 1.6
196 *
197 * @beaninfo
198 * bound: true
199 * hidden: true
200 * description: Mechanism for transfer of data into the component
201 */
202 public void setTransferHandler(TransferHandler newHandler) {
203 TransferHandler oldHandler = transferHandler;
204 transferHandler = newHandler;
205 SwingUtilities.installSwingDropTargetAsNecessary(this, transferHandler);
206 firePropertyChange("transferHandler", oldHandler, newHandler);
|