Skip to main content

[JAVA2D] transparent windows yet?

5 replies [Last post]
Anonymous

Call setOpaque(false); on your window. Then, when you repaint it, do
something like:

public void paintComponent(Graphics g)
{
Composite oldComposite = g.setComposite(AlphaComposite.Clear);
g.fill(getBounds());
g.setComposite(oldComposite);

//Rendering code
}

Mark McKay

Rob Ross wrote:

> I'm in the middle of a project where being able to make a window's
> background
> translucent/semi-transparent would be a very very cool thing
> to have.
>
> Is this possible yet with 1.4? If not, how about 1.5?
>
> Is this feature really that hard to implement?
>
> I'm asking honestly, I don't know what's required in the JVM to make
> this happen. But since both OS X and WindowsXP seem to do this all the
> time now, I have to assume most of the "hard" code already has been
> written in those platform's native libraries.
>
>
> Rob Ross
> Senior Software Engineer
> E! Networks
> rross@eentertainment.com
>
> ===========================================================================
>
> To unsubscribe, send email to listserv@java.sun.com and include in the
> body
> of the message "signoff JAVA2D-INTEREST". For general help, send
> email to
> listserv@java.sun.com and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Rosenstrauch, David

> -----Original Message-----
> From: Discussion list for Java 2D API
> [mailto:JAVA2D-INTEREST@JAVA.SUN.COM]On Behalf Of Kevin Weiner
> Sent: Saturday, May 29, 2004 9:48 PM
> To: JAVA2D-INTEREST@JAVA.SUN.COM
> Subject: Re: [JAVA2D] transparent windows yet?

> Take a look at this also:
> http://www.ibm.com/developerworks/java/library/j-iframe/

Wow - that's hot!!!

DR

==============================================================================
This message is for the sole use of the intended recipient. If you received
this message in error please delete it and notify us. If this message was
misdirected, CSFB does not waive any confidentiality or privilege. CSFB
retains and monitors electronic communications sent through its network.
Instructions transmitted over this system are not binding on CSFB until they
are confirmed by us. Message transmission is not guaranteed to be secure.
==============================================================================

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Rob Ross

Indeed, that looks cool. I'm going to play with that next weekend.

I couldn't tell from the article if he had implemented it using native
code - if so, does that mean it's not cross-platform?? Although I do
most of my deployment with the Windows JRE, I do my development on Mac
OS X. I don't suppose it would work with my mac, will it?

Rob

On Jun 1, 2004, at 6:30 AM, Rosenstrauch, David wrote:

>> -----Original Message-----
>> From: Discussion list for Java 2D API
>> [mailto:JAVA2D-INTEREST@JAVA.SUN.COM]On Behalf Of Kevin Weiner
>> Sent: Saturday, May 29, 2004 9:48 PM
>> To: JAVA2D-INTEREST@JAVA.SUN.COM
>> Subject: Re: [JAVA2D] transparent windows yet?
>
>> Take a look at this also:
>> http://www.ibm.com/developerworks/java/library/j-iframe/
>
>
> Wow - that's hot!!!
>
> DR
>
> =======================================================================
> =======
> This message is for the sole use of the intended recipient. If you
> received
> this message in error please delete it and notify us. If this message
> was
> misdirected, CSFB does not waive any confidentiality or privilege. CSFB
> retains and monitors electronic communications sent through its
> network.
> Instructions transmitted over this system are not binding on CSFB
> until they
> are confirmed by us. Message transmission is not guaranteed to be
> secure.
> =======================================================================
> =======
>
> =======================================================================
> ====
> To unsubscribe, send email to listserv@java.sun.com and include in the
> body
> of the message "signoff JAVA2D-INTEREST". For general help, send
> email to
> listserv@java.sun.com and include in the body of the message "help".
>
>
Rob Ross
Senior Software Engineer
E! Networks
rross@eentertainment.com

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Chet Haase

Rob and Mark,

The solution below will work for lightweight components, but not for
toplevel windows (which is what I assume Rob asking about).

We do not yet (as of 1.5) have the capability of transparent/translucent
toplevel Windows. Yes, the capability exists on some platforms. One of
the tricks in making this work in the library is handling it in a
cross-platform-friendly way.

Anyway, it's one of the things we are hoping to implement
in the next release.

(There are always hack workarounds like using an undecorated frame,
capturing the background of the desktop with Robot, and then
painting the background on top of the frame, but you're probably looking
for something a bit more standard and dependable...)

Chet.

----- Original Message -----
From: Mark McKay
Date: Saturday, May 29, 2004 7:30 am
Subject: [JAVA2D] transparent windows yet?

> Call setOpaque(false); on your window. Then, when you repaint it, do
> something like:
>
> public void paintComponent(Graphics g)
> {
> Composite oldComposite = g.setComposite(AlphaComposite.Clear);
> g.fill(getBounds());
> g.setComposite(oldComposite);
>
> //Rendering code
> }
>
> Mark McKay
>
>
> Rob Ross wrote:
>
> > I'm in the middle of a project where being able to make a window's
> > background
> > translucent/semi-transparent would be a very very cool thing
> > to have.
> >
> > Is this possible yet with 1.4? If not, how about 1.5?
> >
> > Is this feature really that hard to implement?
> >
> > I'm asking honestly, I don't know what's required in the JVM to
> make> this happen. But since both OS X and WindowsXP seem to do
> this all the
> > time now, I have to assume most of the "hard" code already has been
> > written in those platform's native libraries.
> >
> >
> > Rob Ross
> > Senior Software Engineer
> > E! Networks
> > rross@eentertainment.com
> >
> >
> ===========================================================================>
> > To unsubscribe, send email to listserv@java.sun.com and include
> in the
> > body
> > of the message "signoff JAVA2D-INTEREST". For general help, send
> > email to
> > listserv@java.sun.com and include in the body of the message "help".
> >
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in
> the body
> of the message "signoff JAVA2D-INTEREST". For general help, send
> email to
> listserv@java.sun.com and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Rob Ross

It would be nice to have support for true Window transparency, but in
the meantime, the hack you suggested was exactly what I had in mind for
my fall-back technique.

Great minds think alike. Or, at least they all read the same newsgroups.

;)

Rob

On May 29, 2004, at 8:25 AM, Chet Haase wrote:

> Rob and Mark,
>
> The solution below will work for lightweight components, but not for
> toplevel windows (which is what I assume Rob asking about).
>
> We do not yet (as of 1.5) have the capability of
> transparent/translucent
> toplevel Windows. Yes, the capability exists on some platforms. One
> of
> the tricks in making this work in the library is handling it in a
> cross-platform-friendly way.
>
> Anyway, it's one of the things we are hoping to implement
> in the next release.
>
> (There are always hack workarounds like using an undecorated frame,
> capturing the background of the desktop with Robot, and then
> painting the background on top of the frame, but you're probably
> looking
> for something a bit more standard and dependable...)
>
> Chet.
>
>
> ----- Original Message -----
> From: Mark McKay
> Date: Saturday, May 29, 2004 7:30 am
> Subject: [JAVA2D] transparent windows yet?
>
>> Call setOpaque(false); on your window. Then, when you repaint it, do
>> something like:
>>
>> public void paintComponent(Graphics g)
>> {
>> Composite oldComposite = g.setComposite(AlphaComposite.Clear);
>> g.fill(getBounds());
>> g.setComposite(oldComposite);
>>
>> //Rendering code
>> }
>>
>> Mark McKay
>>
>>
>> Rob Ross wrote:
>>
>>> I'm in the middle of a project where being able to make a window's
>>> background
>>> translucent/semi-transparent would be a very very cool thing
>>> to have.
>>>
>>> Is this possible yet with 1.4? If not, how about 1.5?
>>>
>>> Is this feature really that hard to implement?
>>>
>>> I'm asking honestly, I don't know what's required in the JVM to
>> make> this happen. But since both OS X and WindowsXP seem to do
>> this all the
>>> time now, I have to assume most of the "hard" code already has been
>>> written in those platform's native libraries.
>>>
>>>
>
Rob Ross
Senior Software Engineer
E! Networks
rross@eentertainment.com

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Kevin Weiner

Rob Ross wrote:
>
> It would be nice to have support for true Window transparency, but in
> the meantime, the hack you suggested was exactly what I had in mind for
> my fall-back technique.

Take a look at this also:
http://www.ibm.com/developerworks/java/library/j-iframe/

---------------------------------------------------------------------
Kevin Weiner FM Software 610-997-3930 http://www.fmsware.com

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".