Skip to main content

JWebPane project, a browser plugin for Swing and soon FX

Posted by alex2d on December 10, 2008 at 4:08 AM PST

JWebPane overview

Hello blog-o-sphere!

I'm the tech lead of the new JWebPane project, a browser plugin for Swing and soon
FX. We showed a preview this past JavaOne that was well received, and I wanted to
give everyone an update on where we are.

JWebPane is a WebKit based browser component for Java, and will be posted as open
source on in the near future. I'm planning on blogging here frequently,
discussing the architecture of the project as well as how to use it. There's a large
interest in general about WebKit so I'll also talk about some of the aspects of how we
integrated it into Java.

Here is the high level component scheme of the browser component, which also
shows how JWebPane inter-operates with WebKit engine.

We have four basic components:

  • Rendering
  • Networking
  • Timer
  • Events

Each component consists of two parts: the webkit api and a java based
implementation. Actually, there is one more part per each component which is not
mentioned above: the JNI glue code connecting pure java with native C++ based
WebKit. But, it's mostly the straight forward passing of the data so is not terribly
relevant to go into, but I can post more about it if people are interested.

Later on I'll get into the other important aspects of the WebKit engine, such as the
plugins, JavaScript, DOM access, and a few others.

Please feel free to post questions and your thoughts about JWebPane!

Related Topics >>


Well, this is a little disappointing. It's been done before, Webkit's bsd/lgpl2/lgpl2.1 has little to no impact on the license you choose. Google's Chrome is under BSD for instance, Adobe's AIR is proprietary, and Android under Apache2. So any of these two licenses would obviously work, and up to the protective gplv2 + classpath exception ( + exception if its license is not already compatible with the gpl) which would also take care of it. I guess we'll just wait (or use FlyingSaucer).

What happened to flying saucer?

We're working hard to make the project public. But it's not only engineering effort. We're also solving some license questions concerning usage of third party open source code (WebKit). Also, there are some issues concerning redistributing third party libraries which JWebPane depends on. So, even binary-only distribution will not help much to avoid all of this.

I want to run a JWebPane full screen with no address bar, buttons, status bar, etc. Just the web page. I need to know when a user clicks links and which URL it was so I can intercept and maybe close the browser window.

Looking forward to using JWebPane. Will it be a heavyweight or lightweight component? From the diagram, it looks like Webkit rendering will be done by Java2D - does this mean it will be lightweight? Will it be possible to paint the component to other graphics contexts apart from the screen? (e.g print using Java printing API, save as image with Image IO, save as SVG using Batik...)

Thank for the update of status of JWebPane. Yes, many will be glad to know more about the internal architectures of JWebPane and how it works, so do discuss about it frequently. Will there preview feature for JWebPane (like IE/Firefox etc)? So is there a specific timeline for JWebPane's release and beta ? I working on some projects using a third-party embedded browser and will love to use JWebPane.

I'm not sure if anyone thought about this idea ... I think we should have swing markup documents or SML (just like html documents) which are rendered by Java Swing browser. This browser should have two components - network part and layout engine. Just like traditional web application, we should keep actual processing on server side and let client be minimal. We could get / post SML documents ...these documents could be generated by jsp / servlet. I think this could be useful technology ...

can we have binaries before the code is released - so you'll have tests, bug reports and api feedback right now ? or do we still have to wait to try it, and yourself have to wait for months to get real usage feedback ?

I'm also very excited about JWebPane. You pretty much can't blog enough about this. Is there any way we could get a "preview" release. I don't care how buggy it is, I just want to start poking at it. Thanks, Collin

I suppose that we will open the code within couple of months or so. Also, I'm going to give some overview of the api before the opening. We actually have some mechanism of handling loading events and permission requests provided by WebKit engine. I'll provide more info about this in the next posts.

Alexey, I'm definitely excited about this. The native dependency is a little annoying, but understandable. Is there any chance we can at least get a sneak peek at the API? I'm especially interested in the level of control Java code can have in handling events from the browser. How soon is the "near future"?

I came here via the article "How Sun could fix Swing and promote innovation and unification in the UI space" [1]. And I agree with its conclusion: JWebPane could be *the* UI environment for desktop Java, with a brilliant option to go web app at any time via GWT. This would make the Java UI space quite future proof (as browser development is very dynamic at the moment). The only caveat at the moment is that HTML/CSS layout sucks badly for applications. One more thought: However you handle threading, be sure not to fail silently (like Swing), but to throw exceptions (like SWT). [1]

Hi Alexey, Can you comment on whether JWebPane will be able to support 64-bit. Java 1.6 on the Mac is 64-bit only. The other projects that have attempted something similar all choke because the JNI bindings and libraries are 32-bit.

This post should be removed. It only damages Sun's reputation because it announces something that isn't ready to be announced, yet. Some companies might actually start building products that depend on this component and its availability.

Are we going to see a real release for JavaOne ? I hope so.

"related materials" = slides? PDFs? Will there be a release or not?

Here's the status: Wow, end of the year (maybe). Who knows whether it will be released at all at this point. What a major f... up. Great way to treat Java developers with this stall-and-delay tactic. Of course this announcement of JWebPane has delayed or canceled similar project that others were working on.... I agree with dlemmermann below, you should remove this post. Thanks for wasting my time.

So what happened at yesterday's BOF?

This was announced last Java One and still hasn't seen the light of day. Duke Nukem Forever was recently cancelled, I declare JWebPane to be the new Duke Nukem Forever.

It would have been nice to at least have a beta release this summer so the developer community could have something to try out and give feedback. It is unfortunate to see that is not happening and the release now being some undetermined date with only suggestions of the end of year. If it is marketing is holding up the release then that is a truly bad marketing strategy.

Does JWebPane allow access to the DOM of loaded pages? Is it possible to listen for events (clicks etc.) for recording test cases of web applications and e.g. "click" on DOM elements for playback?

> Does JWebPane allow access to the DOM of loaded pages? Is it possible to listen for events (clicks etc.) for recording test cases of web applications and e.g. "click" on DOM elements for playback?

Currently, the only way to get this information is through executing of custom javascript code on the loaded page. Also, now we don't provide hooks for developer's code to be able to listen to DOM events. However, the work is in progress and we're going to provide direct DOM access and custom DOM event handling by the release time.