Paste HWND (Window Handle) into JPanel

I am trying to embed HWND (Window Handle) in a JPanel.

Actually, I can embed my HWND in a JFrame, but the embedded window always stays on top of another component, and I cannot move it. If you try to remove the entire child component of my JFrame, the HWND will remain there. HWND seems to paint on top of the JFrame, and not as one of its children.

To insert HWND into JPanel, I use User32 via 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 insert HWND into a JPanel or add it to another component so that I can position it as if I were in my interface?

thank

+3
source share
1 answer

JPanels - ( ). (J) . java.awt.Canvas.

+3

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


All Articles