Question

Using JNBridge is it possible to update a JTextField's Text Property from a .Net application?

.Net application -> JNBridge -> JTextField.setText("Something");

Seems like it's possible, but I've not found any solid implementations.

Also does the Java application have to explicitly implement the Java Accessibility API, or is that something that you get for free with all Swing controls?

I'm looking for either a solid "Yes it's possible...I've done it...here's where you start." or "Here's a good reference link".

If my question is vague it's because I'm a .Net guy with little Java experience. I'll be happy to elaborate...

Thanks.

Was it helpful?

Solution

Yes, you can do this using JNBridgePro. Please refer to the Java-in-.NET embedding examples that come with the JNBridgePro installation. There are examples for both WinForms and WPF applications.

Please note that JNBridgePro requires the embedded control to be a heavyweight control -- that is a control with a Windows peer. Most Swing components (including JTextField) are not heavyweight, while AWT controls are. Because of this, we recommend that any all-Swing controls be wrapped in a heavyweight control (generally, an AWT Panel), and that Panel wrapper (with the JTextField, and perhaps other things, inside it) be embedded in the .NET application. But once you've done that, you should definitely be able to access the Text property.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top