Javonet 1.4HF15 Release – Embedding .NET User Controls in Java Now Possible

Tags

The new Javonet 1.4 HF15 has arrived! This is truly a customer-driven release.

This release brings some new features, enhancements and performance improvements while at the same time introducing a breaking new beta feature for embedding UI components. These changes were mostly concentrated on the feedback and requirements of real projects.

Breaking News – Host any WinForms or WPF user control in AWT, Swing and JavaFX

In response to growing demand and due to the fact that we have already unofficially distributed, to some of our customers, a customized release with the possibility of embedding .NET user controls in the Java interface, we are officially including the beta version of our UI integration module in the Javonet 1.4 HF15 release.

The technical possibility of hosting .NET WinForms or WPF user interface controls in Java has theoretically already been here since the very beginning of Javonet, however it required quite a lot of complex custom coding and a few challenging issues need to be solved. Our team has spent a huge amount of time analyzing all possible UI technologies of .NET and Java like WinForms, WPF, AWT, Swing and JavaFX, focusing on their internals and dependencies on an operating system in order to prepare a solution that will fit into Javonet’s style of effortless integration.

The outcome of this research is the beta release of NControlContainer class. This class is a tool that takes care of the whole complexity of hosting any .NET user control directly in Java UI with three lines of code and an extremely easy and intuitive API.

NControlContainer is a container which wraps NObject that holds reference to instance of any .NET user control. Because NControlContainer inherits from Panel it can be added to any Java UI object like Frame, Panel, Grid, Layout components and others.

Regardless of the fact that the container class is still in the beta stage, it is a fully functional and reliable well-tested solution, and the beta stage mostly depends on ongoing research for integration performance with JavaFX and some consideration of the final look of the usage API.

This solution opens up completely new area of integration where you can re-use any existing custom UI component written in .NET like reporting controls, authentication or video rendering that cannot be easily ported to Java, but you can also utilize the user controls from third-party vendors like Telerik, and licenses purchased for .NET developers providing the same user experience in Java solutions.

NEnum passed with “ref”

In this release we have updated the NRef class so you can now pass the NEnum object for methods expecting arguments passed by reference. NEnum is our class that represents the .NET enum value in your Java code. All you have to do is wrap the instance of the NEnum object with NRef and pass it to the “invoke” method.

Thanks to the built-in pass by reference mechanism, the value of NEnum instance in Java will automatically be updated when the .NET code changes the value of the provided ref argument.

Java method goes into .NET CLR as a delegate!

With Javonet 1.4 HF15 we have achieved what some developers say is impossible. Now with Javonet you can take a piece of Java code and pass it to the .NET method or field expecting a delegate. Each time the .NET code invokes that delegate, your Java code will be called with our seamless high-performance integration.

All arguments passed to the delegate from .NET world will arrive at your Java method in object array. You can interact with them like any .NET object in the Javonet world.

To pass part of your Java code as a delegate to the .NET world you should use a new NDelegate class which provides the abstract method delegateCalled. In override of this method you can place any code that will be called when the delegate is invoked.

This improvement will prove its usability, especially in situations where you have a third-party .NET module which expects to pass delegate as callback method to be invoked on some special events of processing in that module. With Javonet 1.4 HF 15 you can easily utilize that object in Java as well.

Other improvements

With ongoing efforts, we have made some minor improvements including the possibility of setting value by index on classes with overloaded index operator and some updates and improvements in Java doc on our API.

More details on new features

Keep following our social channels and official blog to read our upcoming articles and find out more about the usage and technical details of new features included in this release.

Don’t hesitate to share that article and spread the word about making the Java to .NET barrier disappear.

Download Javonet 1.4 HF 15 today:
https://www.javonet.com/download/

Don’t have your license key? Sign-up for 30-day free trial:
https://www.javonet.com/signup-for-trial/

Follow us:
Facebook: https://www.facebook.com/thejavonet
Twitter: https://twitter.com/javonet1
LinkedIn: https://www.linkedin.com/company/javonet
GitHub: https://github.com/javonet