DJ Native Swing 0.9.8 - Web Browser, Flash Player and More

DJ Native Swing allows to easily integrate some native components into Swing applications, and provides some native utilities to enhance Swing's APIs.

 Web browserFlash player

 media playerHTML editor

 

The main focus is the integration of a native Web Browser and Flash Player using a Swing-like API. Nevertheless, it also offers other useful components like a multimedia player (based on VLC), an HTML editor (using FCKeditor or TinyMCE) and a Syntax Highlighter.
All the threading issues and general integration headaches are handled automatically. It also allows to mix lightweight and heavyweight components without major visual problems.


Native Swing: http://djproject.sourceforge.net/ns
Screenshots: http://djproject.sourceforge.net/ns/screenshots
Webstart Demo: http://djproject.sourceforge.net/ns/DJNativeSwing-SWTDemo.jnlp

The Webstart demo is configured to work on Windows. It also works on Linux (GTK, x86/i386) where XULRunner is installed. Note that this demo is part of the release distribution.

It uses SWT under the hood, and thus should work everywhere SWT allows to be placed inside a Swing component. To get the web browser to work on Linux, follow the FAQ on SWT's website (XULRunner may be required).
DJ Native Swing is licensed under LGPL and requires Java 5 or later.

Note that it is a sub-project of the DJ Project ( http://djproject.sourceforge.net ), which is a set of tools and libraries to enhance the user experience of Java on the Desktop.

This release adds cookie management to the JWebBrowser, updates the JVLCPlayer API and fixes many bugs.

-Christopher

0

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

Comments

anigart replied on Wed, 2009/03/25 - 4:51am

Christopher,

This is some really great stuff. I have some questions:

1) Are there major changes in the media player? I understand that the current version utilizes the Windows media player on Windows rather than VLC, at least the one in the DJ Project.

2) Is there any support for MacOS?

3) Will the license be LGPL, as it is with DJ?

Thanks,

Martin

Christopher Deckers replied on Wed, 2009/03/25 - 7:45am in response to: anigart

Hi Martin,

1. There are 2 media players: JWMediaPlayer (for Windows only) and the JVCPlayer (Windows and Linux). I made some changes to the JVLCPlayer because the player was no longer working with more recent VLC versions. I think I added a few methods to the JWMediaPlayer as well, but these are minor.

2. Not yet: I first need an SWT bug to be fixed, and then some simple things may already be working. I would then need to implement some more advanced capabilities onto which I have no visibility about the complexity.

3. License is LGPL indeed.


-Christopher

anigart replied on Wed, 2009/03/25 - 1:21pm

Thanks for your reply and all the great work you are doing. This is all good news!

As a minor comment, the function that I miss with the media player is to set the playback on "loop". I have come around that by setting play count to Integer.MAX_VALUE, but that seems like a hack.

 Best,

 Martin

Christopher Deckers replied on Wed, 2009/03/25 - 4:50pm in response to: anigart

> As a minor comment, the function that I miss with the media player is to set the playback on "loop".

If I remember correctly, this is a limitation from the media player. If the native media player has the capability, then I can easily expose the API. This is true for any missing API that you may find and that is actually supported by the native media player.

-Christopher

 

Jeff Stano replied on Fri, 2009/03/27 - 5:19pm

Is there a way to embed Adobe Acrobat Reader on Windows?

I'm using now to embed the browser. Works great!

Jeff

Bora Ertung replied on Sat, 2009/03/28 - 1:17am

Do you plan to support WebKit, (a multi platform support perhaps)? Can javascript communicate back to Java?

Christopher Deckers replied on Sat, 2009/03/28 - 6:15am in response to: js12492

Hi Jeff,

If you have the Acrobat plugin for your browser (most people do I guess), then you can simply open it in the JWebBrowser.

The reason I do not provide a Swing-like component to support it is that there does not seem to be a Javascript API that would allow me to control it.

-Christopher

Christopher Deckers replied on Sat, 2009/03/28 - 6:21am in response to: boraert

> Do you plan to support WebKit

I use SWT under the hood so if SWT one day supports WebKit, then I would definitely add it.

On theother hand, if what you are looking for is a cross platform browser, then you can use XULRunner.

> Can javascript communicate back to Java

Yes, by using what I call the "command channel". Check the demo application to see how a web browser or a flash application can communicate with the Java container.

-Christopher

rkriitr replied on Sat, 2009/04/04 - 1:20am

Hi Chris, Does your simpleWebBrowserExample.java, if open any web-site supports CSS, javascript, cookies, flash etc. As, I see there are seperate examples given for each of above.

Christopher Deckers replied on Sat, 2009/04/04 - 4:27am in response to: rkriitr

Hi,

Yes it should because it is a native web browser (IE, XULRunner/Firefox) that is integrated.

-Christopher

rkriitr replied on Mon, 2009/04/06 - 10:08am

Hi Chris, If menu bar and buttonbar is disabled. It should not listen to the key events of VK_backspace and ALT+left/right arrow as well. I think, this is an issue.

kguptajavalobby replied on Thu, 2009/08/27 - 7:39am

Hi Chris, I tested this projected on Mac, downloaded a swt.jar for removing the exceptions. Running the webbrowser example (webbrowser + flash) (i am using the 0.9.9 version), it hangs and does not show any thing on the frame (blank frame). As Mac uses Safari, does this sample has safari compatability? Please help. Note: on Windows it works fine.

Comment viewing options

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