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 fbd9104c..4acb0cb2 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.28 2003/12/19 04:07:33 mdb Exp $ +// $Id: SwingUtil.java,v 1.29 2004/01/12 08:39:49 ray Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -246,13 +246,27 @@ public class SwingUtil public static void setEnabled (Container comp, final boolean enabled) { applyToHierarchy(comp, new ComponentOp() { - public void apply (Component comp) - { + public void apply (Component comp) { comp.setEnabled(enabled); } }); } + /** + * Set the opacity on the specified component, and all of its + * children. + */ + public static void setOpaque (JComponent comp, final boolean opaque) + { + applyToHierarchy(comp, new ComponentOp() { + public void apply (Component comp) { + if (comp instanceof JComponent) { + ((JComponent) comp).setOpaque(opaque); + } + } + }); + } + /** * Apply the specified ComponentOp to the supplied component * and then all its descendants.