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

Print this page

        

*** 61,70 **** --- 61,72 ---- import javax.swing.event.*; import javax.swing.plaf.*; import static javax.swing.ClientPropertyKey.*; import javax.accessibility.*; + import sun.awt.AWTAccessor; + import sun.swing.SwingUtilities2; import sun.swing.UIClientPropertyKey; /** * The base class for all Swing components except top-level containers.
*** 4871,4880 **** --- 4873,4908 ---- */ public boolean isValidateRoot() { return false; } + /** + * Invalidates this component and its ancestors. + * + * Unlike the super method ({@link java.awt.Container#invalidate}), this + * method stops invalidating the parents of this component when it + * encounters a {@code validate root} (see {@link #isValidateRoot}). The + * {@code validate root} becomes the last invalidated component in the + * hierarchy. A subsequent call to the {@code revalidate()} method will + * restore the validity of the hierarchy. + * <p> + * If this component is not contained within a {@code validate root}, then + * the behavior of this method does not differ from its super version. + * + * @since 1.7 + * @see #revalidate + */ + @Override + public void invalidate() { + synchronized (getTreeLock()) { + if (!isValidateRoot()) { + super.invalidate(); + } else { + AWTAccessor.getComponentAccessor().invalidateImpl(this); + } + } + } /** * Returns true if this component tiles its children -- that is, if * it can guarantee that the children will not overlap. The * repainting system is substantially more efficient in this