• RSS
  • subscribe
  • twitter

Recent Posts

MozSwing – A smart browser built on XUL and Java Swing

The MozSwing project seeks to integrate Mozilla’s XUL framework with Sun’s Java Swing GUI framework, the result is a prism-like browser called MozSwing that can be download as a JNLP(Java Network Launching Protocol) file.

Running the jnlp file will also run an extension-installer that will install platform and OS-specific XUL libraries in your Java Web Start cache. So your platform needs Java Web Start — which is automatically installed together with Java Runtime Environment (JRE).

The advantage in using the MozSwing approach is that, you have both rendering and scripting access from a Swing application to almost any XPCOM components that can be embedded in a Mozilla browser – browser plugins.
MozSwing plays Flash right out of the box, if flash is installed for Firefox.

Installing MozSwing in Windows is pretty easy, so far as you have JRE on and running.
In Ubuntu Hardy, JRE for Ubuntu may not be enough because Java Web Start launches the installer but fails to launch the jnlp file with the subsequent error “Java Web Start – Launch File Error”

MozSwing is triple-licensed: MPL 1.1, GPL 2.0and LGPL 2.1.
The MozSwing project is currently funded by Concord Consortium.

Authors Notes: Fear not jnlp files. The Java Web Start allows application to be started directly from the Internet using a web browser. Alternatively, an application could be started from local computer using a JNLP file (Java Network Launch Protocol file) which is often about 3-5Kb in size.

The Java Web Start caches the entire application locally on user’s computer. Thus, subsequent launches are almost instantaneous as all the required resources are already available locally. Every time the user starts the application, the Java Web Start component checks the application’s website to see if a new version is available, if so, it automatically downloads and launches it. So Java Web Start guarantees that the user is always running the latest version of the software eliminating complicated installation or upgrade procedures.
Download MozSwing

  • Boh

    Nice and simple browser.

  • jean

    I’ll stay with FF. thanks

  • FoxEyes

    Is there a way to hide the address bar? I’ve looked through the mailing list, but the solution they mention there did not work. (using the getToolbar/getStatubar functions and applying a setVisible(false) to them)

  • http://www.kabatology.com/ Martin Kaba

    @ FOXEYES: I’m sorry but I did not find much information on that, if you find out let us know. thanks

  • Jörn Heid

    @FOXEYES The MozillaPanel has a constructor where you can set the toolbar and statusbar to invisible.

    The work is really great and I hope more people will find this usefull software.

  • http://www.kabatology.com/ Martin Kaba

    @JöRD HEID: Many thanks for your contribution, i bet you this is great info, for me and certainly for FOXEYES and others.

  • http://blog.dabarobjects.com dabar

    I think being able to easily embed it into other swing applications is the key role as far as I see. Then something i love about FF is the print function. Swing default HTML renderer is terrible and when you do getPrintable from Textpane, it prints terribly. so i think easy integration with other swing components is the key. BTW its great work and great news

  • Pingback: Swing links of the week: October 5 : Pushing Pixels

  • http://aberrantcode.blogspot.com/ Collin

    This looks like a heavyweight component? Is that true? How much access do you have to the rendering engine and underlying content?

  • http://www.kabatology.com/ Martin Kaba

    @COLLIN; Heavyweight component? Why? You can download the source code if you want to get deeper.

  • James

    @Collin: Yes, the component is heavyweight for now, which is unfortunate. I think that work is being done to try and make it a lightweight component, which would be great if it were possible.

  • Mathew P

    The easiest way to remove the Toolbar is by getting the tool bar object from the MozillaPanel object and then call the removeAll() function.
    Here goes an example adapted to Example01_CreateWindow found under the org.mozilla.browser.examples package:

    MozillaWindow win = new MozillaWindow();
    MozillaPanel moz = win.getPanel();
    win.setSize(500, 600);
    JToolBar stBar = moz.getToolbar(); //this gets the JToolBar object, which is the browser’s toolbar
    stBar.removeAll(); //After you get a hold of this object you can manipulate it the way you’d like
    moz.load(“about:”);
    win.setVisible(true);

  • http://www.kabatology.com/ Martin Kaba

    @ MATHEW: Thanks for your contribution.

  • Mathew P

    Here goes the right way of doing it. Sorry for providing a not so good example. There isn’t a whole lot of documentation on MozSwing.

    MozillaPanel p = new MozillaPanel(MozillaPanel.VisibilityMode.FORCED_HIDDEN, MozillaPanel.VisibilityMode.FORCED_HIDDEN); //This will force to hide the tool bar and status bar
    MozillaWindow mw = new MozillaWindow(p);
    mw.setSize(500,600);
    p.load(“about:”);
    mw.setVisible(true);

  • http://twitter.com/kabatology/status/1339224116 Martin Kaba

    A smart browser built on XUL and Java Swing; Mozswing http://tinyurl.com/5z2m2z

  • http://twitter.com/kabatology/status/1647080924 Martin Kaba

    MozSwing – A smart browser built on XUL and Java Swing http://tinyurl.com/5z2m2z

  • http://twitter.com/kabatology/status/1647084051 Martin Kaba

    MozSwing – A smart open source browser built on XUL and Java Swing http://tinyurl.com/5z2m2z

  • http://www.alamosys.com marlon

    Does any one know where i can find a tutorial to get me started on this. How does one use the component in netbeans ide

  • Ajith

    I was working on a little project of mine and needed a way to embed Firefox in a Java UI Component. This is just the thing I need. Awesome work!
    Could someone tell me if MozSwing uses the default Firefox profile under ~/.mozilla/firefox/profiles? If not, how can I force MozSwing to use that profile? Alternatively, can MozSwing be setup to use a profile at a different location? My requirement is to be able to create and access cookies.