简体   繁体   中英

Java, SWT, make the window (shell) transparent in part

I have a similar example like this:

http://www.java2s.com/Tutorial/Java/0300__SWT-2D-Graphics/CreatefilledrectanglesusingthefillRectanglemethods.htm

All I want to do now is make that red rectangle "punch out" the window, so that I can see what is behind it

Multiple options, for a java solution: Use the javax robot package to screenshot and use it on the background... It's not ideal and if the window moves, the background changes? But anyway, the true solution would be to use JNI to make the actual API calls. Check out the Java Runtime Source on OpenJDK to see how the AWT interfaces with its supported Operating Systems. Window opacity is a gimmick and a sign of poor design. If you're too inexperienced with C/C++ or any other native interface language, I defer you to JOGL , or idealistically LWJGL . Which are prebuilt/packaged JNI bindings for (as GL implies) OpenGL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM