Question

I am creating a JFrame Form using Netbeans .Is it possible to make transparent half portion of the JFrame and the remaining half portion as the same . If i use opacity property it applies on the full portion of the JFrame

How is possible to make some portion of the JFrame transparent using java swing.

Was it helpful?

Solution

you could try using a non transparent panel for the half of the frame that you don't want to be transparent and the rest you could use setOpacity();

OTHER TIPS

Nope, this isn't possible. It's all or nothing.
To achieve the effect you're describing you'll want to make the JFrame fully transparent as you are doing. Then put two JPanel inside; make one JPanel opaque and the other transparent.

Edit
After a bit of internetting, I believe this actually can be done to some extent. Using GradientPaint in a custom paint function, you could probably achieve something to this effect.

However, this approach would be, in my opinion, harder to achieve, harder to maintain, less intuitive and less legible.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top