Change AbstractManagedWindowContainer's background color to white?

Roman Kennke roman at kennke.org
Tue Aug 16 12:16:00 PDT 2011


I am wondering if the background shouldn't come from the AWT component
instead? I remember having seen a test about this somewhere...

Besides that, it is fine for me to apply this patch.

Would you join #caciocavallo? I would like to discuss what remaining
issues we have and what is your plans for going forward.

Roman


Am Dienstag, den 16.08.2011, 20:18 +0200 schrieb Clemens Eisserer:
> Hi Roman
> 
>         not sure. What about configurable with default to white?
> What do you think about the patch?
> FullScreenWindowFactory.screenSize is also initialized this way, I
> think a sys-property isn't that bad?
>  
> 
>         Will deploy the latest code today. I also have some small
>         modifications
>         to commit, and some enhancements to code. Overall I am totally
>         impressed
>         by the whole project.
>  
> Looking forward to see your changes =)
> 
> Thanks, Clemens
> 
> 
> ---
> old/src/share/classes/sun/awt/peer/cacio/managed/AbstractManagedWindowContainer.java    2011-08-16 20:00:59.834391838 +0200
> +++
> new/src/share/classes/sun/awt/peer/cacio/managed/AbstractManagedWindowContainer.java    2011-08-16 20:00:59.746392939 +0200
> @@ -33,9 +33,11 @@
>  import java.awt.event.MouseEvent;
>  import java.awt.event.KeyEvent;
>  import java.awt.geom.Rectangle2D;
> +import java.security.*;
>  import java.util.LinkedList;
>  import java.util.Iterator;
>  import sun.awt.peer.cacio.CacioComponent;
> +import sun.security.action.*;
>  
>  /**
>   * A base implementation of {@link ManagedWindowContainer}. This can
> be
> @@ -46,6 +48,19 @@
>  abstract class AbstractManagedWindowContainer
>      implements ManagedWindowContainer {
>  
> +    private static final Color backgroundColor;
> +    static {
> +    String bgString = AccessController.doPrivileged(new
> GetPropertyAction("cacio.managed.bg", "WHITE")).toUpperCase();
> +
> +    Color bgColor = Color.WHITE;
> +    try {
> +        bgColor = (Color) Color.class.getField(bgString).get(null);
> +    } catch (Exception ex) {
> +        System.out.println("Color specified in cacio.managed.bg not
> found, defaulting to WHITE");
> +    }
> +    backgroundColor = bgColor;
> +    }
> +
>      /**
>       * The child windows of this container.
>       */
> @@ -220,7 +235,7 @@
>                  }
>              }
>          }
> -        Graphics2D g = getClippedGraphics(Color.BLACK, Color.BLACK,
> +        Graphics2D g = getClippedGraphics(backgroundColor,
> backgroundColor,
>                                            new Font(Font.DIALOG,
> Font.BOLD, 12),
>                                            rects);
>          g.clearRect(x, y, w, h);
> 
> 





More information about the caciocavallo-dev mailing list