Is it possible to make a window with a transparent background?

I was wondering if it is possible to create a window using SWT, which has either a transparent background or no background (i.e. just buttons and texts are displayed floating). A.

I tried using the setBackground() function, for example:

 shell.setBackground(display.getSystemColor(SWT.TRANSPARENT)); 

but it just shows a window with a black background, not a transparent one. any way to do this?

+4
source share
1 answer

See How to create a transparent and formatted Windows (Java 7 +).

Translucent window with button

.. (SWT) uses its own window scheme, not ugly / normal ...

Use Swing with your native PLAF.

fHnCI.png


Update 1

Me.

.. you need a component (button, etc.), and not the transparency of Window (or ancestor)?

What you answered.

not necessarily the component itself, but the 'area' in which this component is located. If you look at the example of the nested layout above, you will see a transparent win 7 frame, and then you will see a plain gray background. I would like this gray background to be transparent as well.

Window with 'per pixel' translucency

You can create a window with transparency per pixel, where each pixel has its own alpha value. Using this function, you can, for example, create a window that disappears to zero by defining a gradient in alpha values.

And as an aside, this third screenshot is actually the second image torn directly from the page linked in the first sentence of my answer (on the same page where I received the above quote). You followed the link, read the page (see screenshots), try working examples?

+5
source

Source: https://habr.com/ru/post/1386633/


All Articles