[3639] in java-interest

home help back first fref pref prev next nref lref last post

Re: Awt.Component, paint and update in Beta1

daemon@ATHENA.MIT.EDU (Jim Graham)
Mon Nov 20 21:33:30 1995

Date: Sun, 19 Nov 1995 18:59:23 -0800
From: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
To: java-interest@java.Eng.Sun.COM, michel@mmania.com


Hi Michel,

> I'm having a little problem with the paint and update method of an
> awt.Component: the basic idea is that I want an "invisible" component. 
> No, this is not as stupid as it may seem, I just want to take advantage of
> the mouseEnter, mouseDown, ... methods without having any noticeable object
> on screen.

Unfortunately we have no support for transparent Components in this
release.  All Components will have some background color, and although
you can paint over it as much as you want, you can't prevent it from
opaquely obscuring everything underneath you.

> So I thought that it should be easy to derive a testCanvas class from
> awt.Canvas, and overide paint and update as empty methods.
> 
> However, it appears that "some other objects ..." are still erazing the
> testCanvas' position with the backgroundColor of the testCanvas object.
> 
> In the src/java/awt/Component.java file, there's a comment next to the
> update method which says: "you can assume that the background has not been
> erazed" ... It does not seem to be right...

The update method only bypasses the background painting in one particular
case - when you call the "repaint()" method.  All other causes for painting,
primarily display damage caused by moving or resizing windows, will cause
the background to be painted.  On many platforms the system does this
without any chance for the application to prevent it.

Java does not generally allow drawing on an underlying Component to
show through an overlapping Component.  Drawing is generally clipped to
all overlapping Components.

In a future release, we might implement an "input-only" Component which
received input, but which could not be drawn to.  Would that satisfy
your needs?

				...jim
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post