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.

有帮助吗?

解决方案

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();

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top