Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Transparent Canvas Background?

814 views
Skip to first unread message

Brendan Whelan

unread,
Mar 24, 1999, 3:00:00 AM3/24/99
to
Does anyone have any ideas on how
to make a canvas background transparent?

I am writing a Icon class (extends Canvas)
which will be added to a panel. The problem
is that the Icon overrides the painted panel
with a white rectangle. I want the background
of the Icon to allow the painted panel
behind to show through

any ideas? I've tried copying a section of the
parent canvas, but I can't find a way to
draw it on the Icon canvas.


M Taylor

unread,
Mar 24, 1999, 3:00:00 AM3/24/99
to
There is no way to make a heavyweight container transparent. You can,
however, use or extend Container instead. Your background should then
be visible.

Souljah

unread,
Mar 24, 1999, 3:00:00 AM3/24/99
to
look into setOpaque(false). I've used this where I've had a label on top of
which I wanted to put another label, but the smaller label kep falling
behind the larger one. So I put the smaller label on a panel and set the
panel to setOpaque(false) so that it looked like the smaller label was on
top of the larger one whereas in fact it was on top of a large panel.

Brendan Whelan wrote in message ...

Mr. Tines

unread,
Mar 24, 1999, 3:00:00 AM3/24/99
to
###

On Wed, 24 Mar 1999 21:23:30 -0000, in <zIcK2.1356$kh3...@news.indigo.ie>
"Brendan Whelan" <bhwh...@indigo.ie> wrote.....

> Does anyone have any ideas on how
> to make a canvas background transparent?

you can't make a java.awt.Canvas transparent;
it's an opaque operating system window. Use
java.awt.Component as your base class

-- PGPfingerprint: BC01 5527 B493 7C9B 3C54 D1B7 248C 08BC --
_______ {pegwit v8 public key =581cbf05be9899262ab4bb6a08470}
/_ __(_)__ ___ ___ {69c10bcfbca894a5bf8d208d001b829d4d0}
/ / / / _ \/ -_|_-< www.geocities.com/SiliconValley/1394
/_/ /_/_//_/\__/___/@windsong.demon.co.uk PGP key on page

### end pegwit v8 signed text
aa0188cae0aa216a16681a473fb8841b587df35896ee6dc52cf93cc8d685
761cf98dab3593e0b5b051b43ab808e490c41763762b0140095c669f5398


Brendan Whelan

unread,
Mar 25, 1999, 3:00:00 AM3/25/99
to

Mr. Tines wrote in message <03241999...@windsong.demon.co.uk>...

>###
>
>On Wed, 24 Mar 1999 21:23:30 -0000, in <zIcK2.1356$kh3...@news.indigo.ie>
> "Brendan Whelan" <bhwh...@indigo.ie> wrote.....
>
>> Does anyone have any ideas on how
>> to make a canvas background transparent?
>
>you can't make a java.awt.Canvas transparent;
>it's an opaque operating system window. Use
>java.awt.Component as your base class


That worked!
By using a component class and making sure that
the paint method of both the component and
container panel called the superclass paint
method, the background shows through.

Thanks for the help everyone!

B.


0 new messages