The Source for Java Technology Collaboration

Home » java.net Forums » JavaDesktop Announcements » JavaDesktop Product Announcements

Thread: DJ Native Swing 0.9.7 - Web Browser, Flash Player and more!

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 10 - Last Post: Oct 20, 2009 3:01 PM by: yangju Threads: [ Previous | Next ]
chrriis

Posts: 13
DJ Native Swing 0.9.7 - Web Browser, Flash Player and more!
Posted: Nov 18, 2008 3:06 PM
  Click to reply to this thread Reply

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

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 XPCOM access for the JWebBrowser when using XULRunner, an additional editor implementation for the JHTMLEditor using TinyMCE and a Syntax Highlighter.

-Christopher

illegolas

Posts: 2
Re: DJ Native Swing 0.9.7 - Web Browser, Flash Player and more!
Posted: Nov 23, 2008 11:26 PM   in response to: chrriis
  Click to reply to this thread Reply

Hey chrriis,

I tried using this library for using HTML Editor and found it awesome.

But I could not find one thing that how I can get the caret position and how effectively I can use it in this editor to programmatically append some text at the caret position.

Thanks

chrriis

Posts: 13
Re: DJ Native Swing 0.9.7 - Web Browser, Flash Player and more!
Posted: Nov 24, 2008 12:23 AM   in response to: illegolas
  Click to reply to this thread Reply

Hi,

> But I could not find one thing that how I can get the
> caret position and how effectively I can use it in
> this editor to programmatically append some text at
> the caret position.

This is not currently possible. At the moment, this component is a simple HTML editor where you set the HTML text, or get the current edited content. All the other actions are performed within the editor area and its toolbar.

Nevertheless, I will think about such API for potential inclusion in future releases.

Thanks a lot for your feedback!

-Christopher

illegolas

Posts: 2
Re: DJ Native Swing 0.9.7 - Web Browser, Flash Player and more!
Posted: Nov 24, 2008 1:29 AM   in response to: chrriis
  Click to reply to this thread Reply

I think if you could do that then such API will make it more powerful in that case.

Thanks for the quick reply.

dieguete

Posts: 3
Re: DJ Native Swing 0.9.7 - Web Browser, Flash Player and more!
Posted: Mar 11, 2009 4:37 AM   in response to: chrriis
  Click to reply to this thread Reply

With the example code, the browser window opens, but the next exception is shown

Failed to create chrriis.dj.nativeswing.swtimpl.components.NativeWebBrowser[1/1559649526]

Reason:
java.lang.RuntimeException:java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodError: org/eclipse/swt/browser/Browser.getBrowserType()Ljava/lang/String;

please, help...

dieguete

Posts: 3
Re: DJ Native Swing 0.9.7 - Web Browser, Flash Player and more!
Posted: Mar 11, 2009 4:38 AM   in response to: dieguete
  Click to reply to this thread Reply

* removed *

Message was edited by: dieguete

dieguete

Posts: 3
Re: DJ Native Swing 0.9.7 - Web Browser, Flash Player and more!
Posted: Mar 11, 2009 4:39 AM   in response to: dieguete
  Click to reply to this thread Reply

The code is the following:

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
 
import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
 
import chrriis.common.UIUtils;
import chrriis.dj.nativeswing.swtimpl.NativeInterface;
import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
 
/**
 * @author Christopher Deckers
 */
public class SimpleWebBrowserExample extends JPanel {
 
	public SimpleWebBrowserExample() {
		super(new BorderLayout());
		JPanel webBrowserPanel = new JPanel(new BorderLayout());
		webBrowserPanel.setBorder(BorderFactory.createTitledBorder("Native Web Browser component"));
		final JWebBrowser webBrowser = new JWebBrowser();
		webBrowser.navigate("http://www.google.com");
		webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
		add(webBrowserPanel, BorderLayout.CENTER);
		// Create an additional bar allowing to show/hide the menu bar of the
		// web
		// browser.
		JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 4));
		JCheckBox menuBarCheckBox = new JCheckBox("Menu Bar", webBrowser.isMenuBarVisible());
		menuBarCheckBox.addItemListener(new ItemListener() {
			public void itemStateChanged(ItemEvent e) {
				webBrowser.setMenuBarVisible(e.getStateChange() == ItemEvent.SELECTED);
			}
		});
		buttonPanel.add(menuBarCheckBox);
		add(buttonPanel, BorderLayout.SOUTH);
	}
 
	/* Standard main method to try that test as a standalone application. */
	public static void main(String[] args) {
		UIUtils.setPreferredLookAndFeel();
		NativeInterface.open();
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				JFrame frame = new JFrame("DJ Native Swing Test");
				frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				frame.getContentPane().add(new SimpleWebBrowserExample(), BorderLayout.CENTER);
				frame.setSize(800, 600);
				frame.setLocationByPlatform(true);
				frame.setVisible(true);
			}
		});
		NativeInterface.runEventPump();
	}
}


lorth

Posts: 1
Re: DJ Native Swing 0.9.7 - Web Browser, Flash Player and more!
Posted: Mar 19, 2009 8:15 AM   in response to: dieguete
  Click to reply to this thread Reply

I have the same problem with flash player. It's linking problem. You have to include jar files and additional archives from lib folder (distributed with DJNS). I don't know how exactly. I'll post a note when I'll figure it out.

chrriis

Posts: 13
Re: DJ Native Swing 0.9.7 - Web Browser, Flash Player and more!
Posted: Mar 24, 2009 12:18 PM   in response to: chrriis
  Click to reply to this thread Reply

Hi,

Sorry about the late reply.

The problem is that the wrong version of SWT is used. You need at least SWT 3.5M1 for this to work.
Note that the correct versions of the libraries can be found under the lib folder.

-Christopher

rtmoran

Posts: 1
Re: DJ Native Swing 0.9.7 - Web Browser, Flash Player and more!
Posted: Oct 13, 2009 9:18 AM   in response to: chrriis
  Click to reply to this thread Reply

Hi,

Platform : Debian Lenny + java6

I'm getting this "unresponsive script" warning:


--------
A script on this page may be busy...(...)

Script: http://127.0.0.1:54130/class/2/chrriis.dj.nativeswing.swtimpl.WebBrowserObject/1/html:27
------

I see the following 27th line :


return window.document[movieName];

must be related with Linux UNC filenames. I suppose is a java programming problem but I would like to know if I could disable those warnings, maybe using about:config in the browser url.

Any tips?

Thanks

yangju

Posts: 1
Re: DJ Native Swing 0.9.7 - Web Browser, Flash Player and more!
Posted: Oct 20, 2009 3:01 PM   in response to: chrriis
  Click to reply to this thread Reply

Christopher:

We are looking at a Richtext html editor inside our applet which is implemented using Swing. I found your project which may fit our needs. But my concern is that the NativeInterface.open() call may not work well in our swing based applet. Is there anyway to use the html editor without using SWT? Could you let me know that if this is going to be a problem or is there any other ways to use the html editor in our applet? Our applet is launched from a web browser. We run jre 1.6.0.

Thanks.




 XML java.net RSS