src/share/classes/java/awt/Component.java

Print this page




1034         firePropertyChange("name", oldName, name);
1035     }
1036 
1037     /**
1038      * Gets the parent of this component.
1039      * @return the parent container of this component
1040      * @since JDK1.0
1041      */
1042     public Container getParent() {
1043         return getParent_NoClientCode();
1044     }
1045 
1046     // NOTE: This method may be called by privileged threads.
1047     //       This functionality is implemented in a package-private method
1048     //       to insure that it cannot be overridden by client subclasses.
1049     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
1050     final Container getParent_NoClientCode() {
1051         return parent;
1052     }
1053 
1054     // This method is overriden in the Window class to return null,
1055     //    because the parent field of the Window object contains
1056     //    the owner of the window, not its parent.
1057     Container getContainer() {
1058         return getParent();
1059     }
1060 
1061     /**
1062      * @deprecated As of JDK version 1.1,
1063      * programs should not directly manipulate peers;
1064      * replaced by <code>boolean isDisplayable()</code>.
1065      */
1066     @Deprecated
1067     public ComponentPeer getPeer() {
1068         return peer;
1069     }
1070 
1071     /**
1072      * Associate a <code>DropTarget</code> with this component.
1073      * The <code>Component</code> will receive drops only if it
1074      * is enabled.
1075      *
1076      * @see #isEnabled
1077      * @param dt The DropTarget
1078      */


8180      * @param out the print writer to print to
8181      * @param indent the number of spaces to indent
8182      * @throws NullPointerException if {@code out} is {@code null}
8183      * @see       java.io.PrintStream#println(java.lang.Object)
8184      * @since JDK1.1
8185      */
8186     public void list(PrintWriter out, int indent) {
8187         for (int i = 0 ; i < indent ; i++) {
8188             out.print(" ");
8189         }
8190         out.println(this);
8191     }
8192 
8193     /*
8194      * Fetches the native container somewhere higher up in the component
8195      * tree that contains this component.
8196      */
8197     Container getNativeContainer() {
8198         Container p = parent;
8199         while (p != null && p.peer instanceof LightweightPeer) {
8200             p = p.getParent_NoClientCode();
8201         }
8202         return p;
8203     }
8204 
8205     /**
8206      * Adds a PropertyChangeListener to the listener list. The listener is
8207      * registered for all bound properties of this class, including the
8208      * following:
8209      * <ul>
8210      *    <li>this Component's font ("font")</li>
8211      *    <li>this Component's background color ("background")</li>
8212      *    <li>this Component's foreground color ("foreground")</li>
8213      *    <li>this Component's focusability ("focusable")</li>
8214      *    <li>this Component's focus traversal keys enabled state
8215      *        ("focusTraversalKeysEnabled")</li>
8216      *    <li>this Component's Set of FORWARD_TRAVERSAL_KEYS
8217      *        ("forwardFocusTraversalKeys")</li>
8218      *    <li>this Component's Set of BACKWARD_TRAVERSAL_KEYS
8219      *        ("backwardFocusTraversalKeys")</li>
8220      *    <li>this Component's Set of UP_CYCLE_TRAVERSAL_KEYS




1034         firePropertyChange("name", oldName, name);
1035     }
1036 
1037     /**
1038      * Gets the parent of this component.
1039      * @return the parent container of this component
1040      * @since JDK1.0
1041      */
1042     public Container getParent() {
1043         return getParent_NoClientCode();
1044     }
1045 
1046     // NOTE: This method may be called by privileged threads.
1047     //       This functionality is implemented in a package-private method
1048     //       to insure that it cannot be overridden by client subclasses.
1049     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
1050     final Container getParent_NoClientCode() {
1051         return parent;
1052     }
1053 
1054     // This method is overridden in the Window class to return null,
1055     //    because the parent field of the Window object contains
1056     //    the owner of the window, not its parent.
1057     Container getContainer() {
1058         return getParent_NoClientCode();
1059     }
1060 
1061     /**
1062      * @deprecated As of JDK version 1.1,
1063      * programs should not directly manipulate peers;
1064      * replaced by <code>boolean isDisplayable()</code>.
1065      */
1066     @Deprecated
1067     public ComponentPeer getPeer() {
1068         return peer;
1069     }
1070 
1071     /**
1072      * Associate a <code>DropTarget</code> with this component.
1073      * The <code>Component</code> will receive drops only if it
1074      * is enabled.
1075      *
1076      * @see #isEnabled
1077      * @param dt The DropTarget
1078      */


8180      * @param out the print writer to print to
8181      * @param indent the number of spaces to indent
8182      * @throws NullPointerException if {@code out} is {@code null}
8183      * @see       java.io.PrintStream#println(java.lang.Object)
8184      * @since JDK1.1
8185      */
8186     public void list(PrintWriter out, int indent) {
8187         for (int i = 0 ; i < indent ; i++) {
8188             out.print(" ");
8189         }
8190         out.println(this);
8191     }
8192 
8193     /*
8194      * Fetches the native container somewhere higher up in the component
8195      * tree that contains this component.
8196      */
8197     Container getNativeContainer() {
8198         Container p = parent;
8199         while (p != null && p.peer instanceof LightweightPeer) {
8200             p = p.getContainer();
8201         }
8202         return p;
8203     }
8204 
8205     /**
8206      * Adds a PropertyChangeListener to the listener list. The listener is
8207      * registered for all bound properties of this class, including the
8208      * following:
8209      * <ul>
8210      *    <li>this Component's font ("font")</li>
8211      *    <li>this Component's background color ("background")</li>
8212      *    <li>this Component's foreground color ("foreground")</li>
8213      *    <li>this Component's focusability ("focusable")</li>
8214      *    <li>this Component's focus traversal keys enabled state
8215      *        ("focusTraversalKeysEnabled")</li>
8216      *    <li>this Component's Set of FORWARD_TRAVERSAL_KEYS
8217      *        ("forwardFocusTraversalKeys")</li>
8218      *    <li>this Component's Set of BACKWARD_TRAVERSAL_KEYS
8219      *        ("backwardFocusTraversalKeys")</li>
8220      *    <li>this Component's Set of UP_CYCLE_TRAVERSAL_KEYS