jdk/src/share/classes/java/awt/Container.java
changeset 4263 db2d1f69a60e
parent 4261 126dc6fe0d7b
child 5277 03170721df2e
equal deleted inserted replaced
4262:3aee79f8498a 4263:db2d1f69a60e
  1581      * @see Container#isValidateRoot
  1581      * @see Container#isValidateRoot
  1582      * @see javax.swing.JComponent#revalidate()
  1582      * @see javax.swing.JComponent#revalidate()
  1583      * @see #validateTree
  1583      * @see #validateTree
  1584      */
  1584      */
  1585     public void validate() {
  1585     public void validate() {
  1586         /* Avoid grabbing lock unless really necessary. */
  1586         boolean updateCur = false;
  1587         if (!isValid() || descendUnconditionallyWhenValidating) {
  1587         synchronized (getTreeLock()) {
  1588             boolean updateCur = false;
  1588             if ((!isValid() || descendUnconditionallyWhenValidating)
  1589             synchronized (getTreeLock()) {
  1589                     && peer != null)
  1590                 if ((!isValid() || descendUnconditionallyWhenValidating)
  1590             {
  1591                         && peer != null)
  1591                 ContainerPeer p = null;
  1592                 {
  1592                 if (peer instanceof ContainerPeer) {
  1593                     ContainerPeer p = null;
  1593                     p = (ContainerPeer) peer;
  1594                     if (peer instanceof ContainerPeer) {
  1594                 }
  1595                         p = (ContainerPeer) peer;
  1595                 if (p != null) {
       
  1596                     p.beginValidate();
       
  1597                 }
       
  1598                 validateTree();
       
  1599                 if (p != null) {
       
  1600                     p.endValidate();
       
  1601                     // Avoid updating cursor if this is an internal call.
       
  1602                     // See validateUnconditionally() for details.
       
  1603                     if (!descendUnconditionallyWhenValidating) {
       
  1604                         updateCur = isVisible();
  1596                     }
  1605                     }
  1597                     if (p != null) {
  1606                 }
  1598                         p.beginValidate();
  1607             }
  1599                     }
  1608         }
  1600                     validateTree();
  1609         if (updateCur) {
  1601                     if (p != null) {
  1610             updateCursorImmediately();
  1602                         p.endValidate();
       
  1603                         // Avoid updating cursor if this is an internal call.
       
  1604                         // See validateUnconditionally() for details.
       
  1605                         if (!descendUnconditionallyWhenValidating) {
       
  1606                             updateCur = isVisible();
       
  1607                         }
       
  1608                     }
       
  1609                 }
       
  1610             }
       
  1611             if (updateCur) {
       
  1612                 updateCursorImmediately();
       
  1613             }
       
  1614         }
  1611         }
  1615     }
  1612     }
  1616 
  1613 
  1617     /**
  1614     /**
  1618      * Indicates whether valid containers should also traverse their
  1615      * Indicates whether valid containers should also traverse their