I am trying to embed a HWND (Window Handle) in a JPanel.
Actually, I can embed my HWND into a JFrame, but the embedded window alway stay on top of the other component and I can't move it. If a try to remove all the child component of my JFrame, the HWND stay there. The HWND seems to be paint on top of the JFrame and not as one of is child.
To embed the HWND into the JPanel I use User32 through jna:
User32.SetParent(iage.getRenderHwnd(), (int) getGUIHwnd(j));
And I use this to get the HWND of my JFrame:
j.getPeer() != null ? ((WComponentPeer) j.getPeer()).getHWnd(): 0;
Is there a way to embed a HWND into a JPanel or to add it into an other component so I can position it like I wan in my UI?
JPanels are lightweighted components (they have no real native peer). i.e. they use already the handle of the (J)Frame. Look at java.awt.Canvas.