diff --git a/projects/samskivert/src/java/com/samskivert/swing/util/SwingUtil.java b/projects/samskivert/src/java/com/samskivert/swing/util/SwingUtil.java index f6b42213..af660a4e 100644 --- a/projects/samskivert/src/java/com/samskivert/swing/util/SwingUtil.java +++ b/projects/samskivert/src/java/com/samskivert/swing/util/SwingUtil.java @@ -1,5 +1,5 @@ // -// $Id: SwingUtil.java,v 1.18 2002/12/09 04:44:36 shaper Exp $ +// $Id: SwingUtil.java,v 1.19 2003/01/11 00:40:39 shaper Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -40,6 +40,8 @@ import java.util.Collection; import java.util.Comparator; import java.util.Iterator; +import javax.swing.JPanel; + import javax.swing.text.AbstractDocument; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; @@ -474,4 +476,16 @@ public class SwingUtil { gfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, rock); } + + /** + * Refreshes the supplied panel display. This should be called after + * adding components to or removing components from the panel since + * Swing doesn't automatically properly invalidate things for + * subsequent re-rendering. + */ + public static void refresh (JPanel panel) + { + panel.revalidate(); + panel.repaint(); + } }