Index: java/awt/Component.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v retrieving revision 1.76 diff -u -r1.76 Component.java --- java/awt/Component.java 23 Sep 2005 20:35:06 -0000 1.76 +++ java/awt/Component.java 27 Sep 2005 13:59:28 -0000 @@ -901,15 +901,15 @@ if (currentPeer != null) currentPeer.setVisible(true); + // The JDK repaints the component before invalidating the parent. + // So do we. + repaint(); // Invalidate the parent if we have one. The component itself must // not be invalidated. We also avoid NullPointerException with // a local reference here. Container currentParent = parent; if (currentParent != null) - { - currentParent.invalidate(); - currentParent.repaint(); - } + currentParent.invalidate(); ComponentEvent ce = new ComponentEvent(this,ComponentEvent.COMPONENT_SHOWN); @@ -947,16 +947,16 @@ currentPeer.setVisible(false); this.visible = false; - + + // The JDK repaints the component before invalidating the parent. + // So do we. + repaint(); // Invalidate the parent if we have one. The component itself must // not be invalidated. We also avoid NullPointerException with // a local reference here. Container currentParent = parent; if (currentParent != null) - { - currentParent.invalidate(); - currentParent.repaint(); - } + currentParent.invalidate(); ComponentEvent ce = new ComponentEvent(this,ComponentEvent.COMPONENT_HIDDEN); Index: javax/swing/JComponent.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v retrieving revision 1.63 diff -u -r1.63 JComponent.java --- javax/swing/JComponent.java 25 Sep 2005 13:55:07 -0000 1.63 +++ javax/swing/JComponent.java 27 Sep 2005 13:59:28 -0000 @@ -44,6 +44,7 @@ import java.awt.Component; import java.awt.Container; import java.awt.Dimension; +import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.FocusTraversalPolicy; import java.awt.Font; @@ -242,7 +243,7 @@ * The text to show in the tooltip associated with this component. * * @see #setToolTipText - * @see #getToolTipText + * @see #getToolTipText() */ String toolTipText; @@ -322,7 +323,7 @@ * try to request focus, but the request might fail. Thus it is only * a hint guiding swing's behavior. * - * @see #requestFocus + * @see #requestFocus() * @see #isRequestFocusEnabled * @see #setRequestFocusEnabled */ @@ -1643,7 +1644,7 @@ /** * Performs double buffered repainting. * - * @param r the area to be repainted + * @param g the graphics context to paint to */ void paintDoubleBuffered(Graphics g) { @@ -2095,8 +2096,19 @@ */ public void revalidate() { - invalidate(); - RepaintManager.currentManager(this).addInvalidComponent(this); + if (! EventQueue.isDispatchThread()) + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + revalidate(); + } + }); + else + { + invalidate(); + RepaintManager.currentManager(this).addInvalidComponent(this); + } } /** @@ -2316,6 +2328,10 @@ public void setVisible(boolean v) { super.setVisible(v); + Container parent = getParent(); + if (parent != null) + parent.repaint(getX(), getY(), getWidth(), getHeight()); + revalidate(); } /**