< prev index next >

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

Print this page




2955 
2956     /**
2957      * Validates this component.
2958      * <p>
2959      * The meaning of the term <i>validating</i> is defined by the ancestors of
2960      * this class. See {@link Container#validate} for more details.
2961      *
2962      * @see       #invalidate
2963      * @see       #doLayout()
2964      * @see       LayoutManager
2965      * @see       Container#validate
2966      * @since     1.0
2967      */
2968     public void validate() {
2969         synchronized (getTreeLock()) {
2970             ComponentPeer peer = this.peer;
2971             boolean wasValid = isValid();
2972             if (!wasValid && peer != null) {
2973                 Font newfont = getFont();
2974                 Font oldfont = peerFont;
2975                 if (newfont != oldfont && (oldfont == null
2976                                            || !oldfont.equals(newfont))) {
2977                     peer.setFont(newfont);
2978                     peerFont = newfont;
2979                 }
2980                 peer.layout();
2981             }
2982             valid = true;
2983             if (!wasValid) {
2984                 mixOnValidating();
2985             }
2986         }
2987     }
2988 
2989     /**
2990      * Invalidates this component and its ancestors.
2991      * <p>
2992      * By default, all the ancestors of the component up to the top-most
2993      * container of the hierarchy are marked invalid. If the {@code
2994      * java.awt.smartInvalidate} system property is set to {@code true},
2995      * invalidation stops on the nearest validate root of this component.
2996      * Marking a container <i>invalid</i> indicates that the container needs to




2955 
2956     /**
2957      * Validates this component.
2958      * <p>
2959      * The meaning of the term <i>validating</i> is defined by the ancestors of
2960      * this class. See {@link Container#validate} for more details.
2961      *
2962      * @see       #invalidate
2963      * @see       #doLayout()
2964      * @see       LayoutManager
2965      * @see       Container#validate
2966      * @since     1.0
2967      */
2968     public void validate() {
2969         synchronized (getTreeLock()) {
2970             ComponentPeer peer = this.peer;
2971             boolean wasValid = isValid();
2972             if (!wasValid && peer != null) {
2973                 Font newfont = getFont();
2974                 Font oldfont = peerFont;
2975                 if (newfont != null && !Objects.equals(oldfont, newfont)) {

2976                     peer.setFont(newfont);
2977                     peerFont = newfont;
2978                 }
2979                 peer.layout();
2980             }
2981             valid = true;
2982             if (!wasValid) {
2983                 mixOnValidating();
2984             }
2985         }
2986     }
2987 
2988     /**
2989      * Invalidates this component and its ancestors.
2990      * <p>
2991      * By default, all the ancestors of the component up to the top-most
2992      * container of the hierarchy are marked invalid. If the {@code
2993      * java.awt.smartInvalidate} system property is set to {@code true},
2994      * invalidation stops on the nearest validate root of this component.
2995      * Marking a container <i>invalid</i> indicates that the container needs to


< prev index next >