Embedding a native window inside a JFrame
Asked Answered
M

1

11

Does anyone know of a method or API that supports embedding a native window inside either a Java JFrame or JPanel?

I found this previous post:

How do I run an external program inside a Java frame in netbeans in a platform independent manner?

I can get the window handle using:

http://www.java-forums.org/advanced-java/44064-getting-window-id-window-frame.html

and this works fine.

This article appears to suggest that it's possible, but does not illustrate how:

Embed HWND (Window Handle) in a JPanel

Molech answered 12/1, 2014 at 14:56 Comment(2)
How does your question differ from the previous one you linked to? If it's the same question, you can put a bounty on it to get more attention to it. If you have enough reputation.Estuary
What do you mean by "a native window"?Intolerant
W
0

I can only repeat the answer given in another question: This is not supported.

Using Windows APIs, you can add a window into a HWND of JFrame, Panel (not JPanel!) or Canvas. Yet Java will never know you did it, it could break many assumptions inside AWT code.

Even when you write a native Win32 app, you can't embed an arbitrary window into your top-level window. If the window you want to embed is a top-level window, it may not play well when it's made a child window of another window because, again, the assumptions are now wrong, some messages are handled differently.

Winston answered 8/9, 2023 at 14:25 Comment(2)
I see my original post was Jan 2014. Thank, but I couldn't wait 9 years.Molech
@GrahamSeed It was still unanswered. I understand my answer doesn't bring much value to you. Yet it may be helpful to someone else researching the subject.Winston

© 2022 - 2024 — McMap. All rights reserved.