Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Transparent Window (SetLayeredWindowAttributes) without frame and controls
Transparent Window (SetLayeredWindowAttributes) without frame and controls [message #461467] Sun, 25 September 2005 08:35
Joe is currently offline JoeFriend
Messages: 12
Registered: July 2009
Junior Member

I try to display a png-Image on a transparent shell (without frame).

The code below can display a transparent shell using
the (native) windows-method "SetLayeredWindowAttributes".
The problem is, that i want to remove the frame around the window.

Creating the shell with
Shell shell = new Shell(SWT.NO_TRIM)
effects that the background is no updated, when the shell is moved.

Someone has an idea how to get the the frame around the window removed,
without loosing the transparency effect?

____________________________________________________________ __

transparent shell with frame
____________________________________________________________ __

import org.eclipse.swt.SWT;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class TransparentWindowTest {
Display display = null;

Shell shell = new Shell(SWT.CLOSE | SWT.MODELESS);
Label l = new Label(shell, SWT.NONE);
private RGB transparentRGB;

public TransparentWindowTest() {
this.display = shell.getDisplay();
OS.SetWindowLong(shell.handle, OS.GWL_EXSTYLE, 0x80000);
transparentRGB = shell.getBackground().getRGB();

// args: windowHandle,,,, alpha ,dw flags
OSEx.SetLayeredWindowAttributes(,,,, 255, 1);

l.setText("a transparent label");
l.setSize(100, 20); PaintListener() {

public void paintControl(PaintEvent event) {
Image imgTest = new Image(Display.getDefault(), "test.png");
event.gc.drawImage(imgTest, 0, 0);


);, 256);;;

while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {

public static void main(String[] args) {

new TransparentWindowTest();


Previous Topic:Word in SWT : Application.Documents.Open fails.
Next Topic:Table editor throws widget disposed error. Please help
Goto Forum:

Current Time: Mon Sep 16 12:25:43 GMT 2019

Powered by FUDForum. Page generated in 0.01523 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top