The paint() routines are limited to the drawing within the window. It has no idea of what’s behind.
The setOpaque() is not affecting the paint but rather an optimisation. It is used to figure out if the component behind needs redrawing.
You can try if the ComponentPeer::StyleFlags help, but the WidowIsSemiTransparent has a note “only for internal use”, so you have to test.
My the Idea for what I’m going to do is having a project without main window and only with a component on screen, is it possible? I can’t immagine actually how I could have a component on screen not inside a window, but a window under the hood inherits Component class so it should be possible…
(I’d like to have a program for example that shows at display only a black square that follows the mouse and that show with a test inside this square the x and y coordinates of the mouse).
Any Component can become a Window by calling addToDesktop (int windowStyleFlags). This is how e.g. PopupMenu and TooltipWindow work (they are not limited by the bounds of the parent window).
The ComponentPeer is the handle for the windowmanager/OS, which is created behind the scenes for you.
Ok really thank you! now the last thing as I supposed is to get it ever in front of other component, as you can see pictures it doesn’t overlap other apps!