Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JNI: Using JDialog in a native application  RSS feed

Markus Moos
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on a native windows application which starts the JVM through JNI. From the java classes I want to display JFrames and JDialogs which have to become children of the native window.
For JFrames and non-modal JDialogs every thing works well. But if I display a modal JDialog the system hangs.
Has anyone an idea how this problem could be solved.
The following C++ code snippet just shows how I solved the problem for non-modal JDialogs and JFrames.
std::string title = "My Java Frame";
// Is a hack, could by done properly by using
HWND child = ::FindWindow( NULL, title.c_str());
HWND parent = i->GetMainWndHandle();
if(parent != NULL && child != NULL) {
::SetParent(child, parent);
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!