Christopher has posted 9 posts at DZone. You can read more from them at their website. View Full User Profile

DJ NativeSwing 0.9.5 - State-of-the-art native component integration for Swing

05.16.2008
| 5195 views |
  • submit to reddit

DJ Native Swing 0.9.5 is finally out! And this is great news for us who just want to integrate native components in our rich Java Swing applications.

DJ Native Swing was designed to handle all the complexity of native integration, mainly in the form of components with a simple Swing-like API.
For the record, here are some screenshots of some of the components in action (click to enlarge):

Web Browser
Flash Player
VLC Player HTML Editor

And here are the project links:

 

This 0.9.5 version originally had humble goals: to expose a simpler API, have some Javadoc, improve examples, and consider user feedback to fix bugs and add new functionalities.

Well, it turns out that there was a large user feedback! And the good thing is that it was not focused on the web browser integration only, as I originally feared, but on all the components (Flash Player, VLC Player, Windows Media Player and HTML editor) as well as the framework.
This resulted in making the framework more robust and better adapted to practical needs.

So here is a list of new and noteworthy features:


  • Framework
    • Improved stability and error reporting.
    • Reduced memory and increased performance.
    • Native components can be printed to an image.
    • Native components have a unified and extensible way of handling their options, passed in their constructors.
    • Simplified API for native components, browser-based components and Ole components.
    • The native interface has a proper lifecycle: it can be closed and re-opened, some listeners allow to track such events.
    • Improved debugging using all sorts of documented system properties.

  • JWebBrowser
    • Invoke Javascript functions that return a result synchronously.
    • Commands sent by a web page back to the application now handle multiple parameters.

  • JFlashPlayer
    • Possibility to completely pilot a Flash application by calling Action script functions and receiving commands.
    • Load a Flash file directly from the classpath.

  • JVLCPlayer
    • The API of the VLC plugin is completely exposed in a similar fashion.

  • JHTMLEditor
    • Customize the behavior by changing the FCKeditor configuration (like changing the toolbars).

  • JWMediaPlayer
    • More of the API of the Windows Media Player is exposed.

 

As usual, let me know what you think, so that the next release pushes the limits even further!

-Christopher

 

0
Published at DZone with permission of its author, Christopher Deckers.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Basil ____ replied on Sat, 2008/05/17 - 10:22pm

This looks like a good solution, but will it be true cross-platform? All the components look just fine, but JWMediaPlayer sounds a bit alarming.

 Anyway, I hope they'll add support for other platforms (at least OS X and Linux). 

Christopher Deckers replied on Sun, 2008/05/18 - 2:46am in response to: Basil ____

> will it be true cross-platform?

The framework is cross-platform and all the components except JWMediaPlayer are. This component serves mainly as an example for people who need to integrate Windows-only components.
The alternative to using JWMediaPlayer is the JVLCPlayer except that it has the drawback of having to be installed.

"True" cross-platform is possible where SWT supports being placed in a Swing component. This is possible on many platforms except Mac (due to the SWT bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=145890 ).

About this Mac issue, I may be able to work around the SWT bug if I had some help from a Mac developer with Carbon and Cocoa knowledge. If any such developer is reading this, contact me!

-Christopher

 

Subin Sugunan replied on Fri, 2009/04/24 - 1:24am

Great work Chris I'm facing an issue with the Flash calls to Java in JFlashPlayer Did u host the ActionScript code too ,which is used in the examples, anywhere ? Thanks Subin

Fx LAMARE replied on Mon, 2009/07/06 - 12:03pm in response to: Subin Sugunan

 

 

 Hi Chris!

 

Really a great lib i was looking for for some time. Like subin, i enconter problems with Flash to Java calls. I'm using AS3 on the flash side, everything seems to load and work properly, except when I try to use ExternalInterface.call() function, where nothing happens (no errors apparently).

   I tried to work on Security with no success:

Security.allowDomain("http://127.0.0.1");

 

Thanks for your feedback!

 

*edit*: just did a test with a sample as2 app, with same results...

Fx LAMARE replied on Mon, 2009/07/06 - 11:14pm in response to: Fx LAMARE

 

Back on the subject. It seems to be related to the Flash scene because if I take the FlashPlayerInteractions.swf with my Java code, everyhing works as expected.

 

I must find the proper setup on the Flash side. In the meantime, if someone has the solution...

 

Thanks!

Fx LAMARE replied on Mon, 2009/07/06 - 11:46pm

 

 I found the mistake. Please check that the call from Flash is as follows :

      flash.external.ExternalInterface.call("sendCommand", "yourcommandName", "yourparam1" [, ...]);

 

Great !

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.