Is there problem with Java and transparent images?

  • Thread starter Ramon F Herrera
  • Start date
R

Ramon F Herrera

My Java application has a splash screen which was inspired on the ones
that are displayed when the Adobe programs (Photoshop, Illustrator,
InDesign) start up.

There is an outside invisible rectangle and some features that pretent
to "come out" of an inside white rectangle.

You may have noticed how Photoshop has some feathers and Illustrator
has some flowers; both have a white inside rectangle with a shadow that
gives a 3-D impression.

My problem is: I cannot achieve the mentioned effect with my Java
application.

Does anyone know whether Java has some limitaion displaying the
transparency part? I get a gray rectangle which should be transparent.
The image is a GIF.

I really appreciate any tips and pointers since I spent a lot on that
splash screen and now it makes my program look not so good.

-Ramon
 
D

Darko Aleksic

I am certain that Java can display transparent .gif's, but you may not
be able to on a splash screen. Maybe you can find something in this
article: http://www.javalobby.org/java/forums/t17720
I think they use transparency in that example.

I don't think you can display transparent images in Java (unless they
changed something). The problem is that top level containers are not
transparent or something.

I think that example is a common workaround - capture the screen
behind the window and then manipulate it to simulate the transparency.
It works fine until the background changes, so try to make sure it
doesn't.

Darko
 
C

Christian Schlichtherle

Java supports transparent images in general (GIF, PNG), but it does not
support transparent window backgrounds to display your transparent image on.

You may want to check skinlf at http://www.l2fprod.com if you'ld like to use
non-rectangular splash screens. The library provides some means and examples
to do this, but unfortunately it relies on native code (Windows, X11) as
their is no pure Java way to do it.

Regards,
Christian
 
A

Andrew Thompson

I don't think you can display transparent images in Java ..

No. Sun's 'WarpImage' source (part of the Java2D demo
examples AFAIR) is supplied with a gif (surfing.gif) that
has transparenct areas defined. If you flip the BG color
to red or black, you can easily see that the BG shows
through just fine.
 
A

Andrew Thompson

Sorry - I misunderstood what you were saying. 'top-level'
containers do not offer transparency - just like you said.
Apologies for the (my) confusion.
 
A

Andrew Thompson

I am certain that Java can display transparent .gif's, but you may not
be able to on a splash screen. Maybe you can find something in this
article: http://www.javalobby.org/java/forums/t17720
I think they use transparency in that example.

Now that I have read this thread more carefully, and
that link, I suggest this is the best way to go.

The screen capture technique can work quite well.
It experiences problems if you go to drag or move
the component*, but that is not something that
should apply to a splash screen.

* Check this post (and resulting thread) for one experimental
implementation of a draggable area with a transparent effect.
<http://groups-beta.google.com/group/comp.lang.java.gui/msg/24d7b4000081cb7d?hl=en>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top