[4486] in java-interest
Transparent Applet, or controls and AWT
daemon@ATHENA.MIT.EDU (Michel Meyer)
Tue Jan 2 19:11:35 1996
Date: Tue, 02 Jan 1996 19:29:37 -0100
To: john@insightnews.com, neilb@the-wire.com, jpayne@starwave.com,
java-interest@java.sun.com
From: michel@mmania.com (Michel Meyer)
>Is it possible to have a transparent applet, or are there any close hacks
>out there to accomplish the same thing? I have yet to see an applet that
>doesn't allocate that gray square chunk in the html document (and I've
>thoroughly searched the internet for one).
This problem of transparency is not particular to applets, the problem is
there for any awt component.
In fact, each time the component is redrawn, someone (and I don't know who
it really is, maybe the peer of the component ...?) erases the background of
this component killing any possibility of transparency and slowing down the
redraw process.
>My solution is that the JDK sould provide the developers with a way of
>reading the image that is under the current panel rather than just drawing a
>rectangle over the top of the background.
I don't think this is a good solution. It goes against the framework philosphy.
the redraw of a component should happen in the following order:
1. container receives a redraw order.
2. It redraws itself (begining with an erase only if it really whishes it,
and that's currently impossible)
3. It calls the draw method of its subcomponents ...
and so on for any subcomponent which is a container...
That way, if a component whishes to be transparent it just doesn't erase
itself first, that will also allow to avoid the flickering that is
happenening when you resize the browser's window for example ...)
To go back to the applet's case. The applet is a component, the browser
should behave like a regular container. So, it will draw the background
(bricks if you want) and the when you draw your applet, you just don't start
with erasing the area.
that should be the way it works.
However for performance reason, especially in the case of a browser, this
will really be efficient only if you have a way to restrain the redraw area
to a certain region, which is now possible (to a rectangle only :( ) in beta.
I already wrote on this mailing list about this MAJOR bug.
I got the following answer from Jim Graham:
>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.
>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.
I hope this will help.
The bottom line is that java and especially AWT have a quite major problem
with that. Apparently due to system constraints (however I know this can be
done on Windows and MacOS, so I hope it's not Microsoft's MFC which is
causing all these troubles...)
Michel MEYER (email: michel@mmania.com)
vp engineering
MultiMania Production
##############################
# MultiMania Production #
# 1.rue de Paradis #
# 75010 Paris #
# FRANCE #
# Tel: 45-23-08-19 #
# E-mail: info@mmania.com #
##############################
--\\
C \\
O \\ The (virtual) Baguette
O // http://www.mmania.com
L //
--//
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com