Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calling modal Java dialog from a C++ application

843829Apr 2 2008 — edited Apr 3 2008
I am writing a C++ plugin for a GUI Windows app. When triggered, my plugin needs to make a JNI call to present a modal Swing dialog, block until the user makes a selection, and then return control to the native application.

I've gotten the Java dialog to work OK by running a Windows message pump on the main thread (I really don't know Windows well enough to know what I'm doing here) and starting a separate thread in Java, which posts the Java GUI action onto the EventQueue. I'm also creating a WEmbeddedFrame with the HWND of the main native window and passing that in as the owner for the JDialog.

The main problem that I'm having is that while my C++ plugin is blocked waiting for user input, the native GUI app in the background usually does not redraw - if the user drags the Java modal dialog around, it leaves a white trail on the window contents behind it. I say 'usually' because sometimes it blanks out the native background window completely when the Swing dialog is displayed.

Any suggestions? I am happy to hire somebody to help with this, if you know how to make this work.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 1 2008
Added on Apr 2 2008
1 comment
236 views