The Java Tutorials' Weblog
HTML Component
The rapid growth of HTML as a basic application platform makes displaying web content a topical question for many developers and designers, whether this content is various web sites or static HTML pages. Therefore, the need has arisen to create a reusable HTML component that can be repeatedly used by different applications and modified according to current business needs. The Java™ platform enables all functionalities to create such cross-platform encapsulation.The HTML component provides a web viewer and full browsing functionality through its API. In particular, it supports events handling, for example, load progress, or URL traversed. The current implementation of the HTML component supports so called "street HTML", an HTML syntax which does not meet all requirements of the HTML specification, however, it is recognized by major world known browsers. Moreover, the component is implemented as lightweight in order to avoid allocating native resources in the operating system's windowing toolkit, and easy integrating with Java and JavaFX graphics libraries. The HTML component is based on WebKit, an open source web browser engine, which supports HTML4, CSS, JavaScript, DOM, SVG.
When designing an embedded browser instance, the following features are typically considered:
- Accessing certain domains
- Accessing the local file system
- Loading a URL
- Moving forward or backward in the browser's history
- Printing web page
- Reloading the current web page
- Stopping loading the web page in progress
- Support for JavaScript and plugins
The following structure depicts the internal architecture of the embedded browser.
Figure 1. The HTML component architecture
The JWebPane component provides basic web page browsing functionality. It renders web pages and provides basic user interaction, such as navigating links, and submitting HTML forms. The JWebPane component displays one web page at a time. The PolicyDelegate is intended for implementing a browser policy. Implementations may use arbitrary logic to enable or reject sensitive operations such as loading web pages, opening new browser windows or running scripts on pages. An implementation may thus act as a list-based URL filter or a popup blocker. A single PolicyDelegate may be associated with a JWebPane object. It then receives notifications from the JWebPane about changes to the browser state that are about to happen. The PolicyDelegate may either accept or reject these changes. The LoadStateListener tracks the state of a page load.
At the moment the project is 70% complete. The JWebPane component implemented as a lightweight component extending the JComponent class, which enables easy embedding into an application UI context. Moreover, the JWebPane component may contain several web frames with the specified icon, title, and URL. The following browsing features are available:
- Loading control — load, stop, and reload functions.
- Listeners handling. — typical function enabling a developer to get, add, and remove listeners.
- JavaScript support
- Page loading started
- HTTP server redirection processed
- Icon for the page received
- Page title received
- Page content loaded completely
- An image contained in the page loaded
- Page and all its resources loaded completely
- Loading Failed
Figure 2. The HTML component embedded into the JavaFX application Click the image to view it at its natural size.
The following new features are scheduled to be implemented by August'08:
- Viewing the History, including Back and Forward functions.
- Notifications of external resources loading
- Progress status
- Viewing page source
JWebPane component in the Artem Ananiev's Blog.
-- Alla Redko
Posted at 02:54PM May 30, 2008 by The Java Tutorial Team | Comments[13]
Friday May 30, 2008
Posted by Artem Ananiev's Blog on June 04, 2008 at 08:58 AM PDT #
Alla,
please check my comment on Artem's second blog post http://weblogs.java.net/blog/ixmal/archive/2008/06/using_jwebpane_1.html
My questions were on customizing JWebPane's CacheManager, availability of LiveConnect, applicability to mobile devices.
This is of interest to our open source Browser Bhoost project (http://bhoost.com).
Another huge area of interest is making native platform APIs (e.g. camera, microphone) available to Web Applications as JavaScript APIs.
Is there any conversation going between JWebPane people and Java Plugin group. Java Plugin recently made very significant progress which gives it a chance to revive Java in the browser. Together with JWebPane and new Java capabilities for the Desktop this may make writing desktop applications with 100% Web UI a great choice for developers. I would be happy to share my thoughts on the matter in more detail if there is any interest.
I also wonder if any thought was given to provide JWebPane API to automation interfaces of other browsers FireFox, IE and Opera?
Gene
Posted by Gene Vayngrib on June 16, 2008 at 06:48 PM PDT #
Hello,
Where can I download from the package which contains JWebPane?
Thanks.
Posted by Alon Singer on June 23, 2008 at 12:27 AM PDT #
Sadly, this component seems to be unavailable anywhere - the JavaFX page mentions it, but the JavaFX download does not include this component - so for me it might as well not exist at all, time to go back to JDIC.
Posted by Peteris on August 12, 2008 at 04:11 AM PDT #
Even more sadly, the announcement of this component appears to have chilled development of other embedded browser solutions. Now I (and other Swing developers) are stuck without anything -- not even a beta -- against which to work. For me, this means slipping project schedules. Not good.
At the very least, give us a beta, so my clients will stop joking that I can't embed Gecko because I've got "a reptile dysfunction".
Posted by handshape on September 11, 2008 at 07:21 AM PDT #
I agree with handshape. A beta version would be very nice.
Posted by Patrick on October 07, 2008 at 05:13 AM PDT #
It's been three months since my earlier post, and there is still no sign of JWebPane. My disappointment with the release-date slip to "a couple of months" after JavaFX 1.0 can't be understated. This, coupled with Sun's apparent backing-off from efforts toward the core Swing APIs has now essentially killed one of my projects.
Posted by handshape on December 05, 2008 at 03:46 PM PST #
More info was posted here:
http://weblogs.java.net/blog/alex2d/archive/2008/12/jwebpane_projec_1.html
but it still hasn't been released.
Posted by Doug Holton on March 14, 2009 at 03:56 PM PDT #
Sooner JWebPane will be released, better it would be.
JWebPane will be an important component for Java, and a good news for SUN
If you like, read my detailled arguments here: http://www.jroller.com/dmdevito/entry/hotjava_may_come_back_due
Posted by Dominique De Vito on April 13, 2009 at 01:25 AM PDT #
Hi, does anyone know where can I get this component? Thanks...
Regards
Mohammed
http://abusleem.net/blog
Posted by Mohammed Saleem on June 30, 2009 at 06:35 AM PDT #
Posted by Raju Bitter on July 29, 2009 at 06:25 PM PDT #
I can not believe that in over 10 years, no one on the entire planet has been able to make a decent Java only webbrowser component that is anything better than awful and utterly useless.
The only quality one that comes to mind is icebrowser, but I remember looking a couple of years back seeing it canned.
Posted by Mike on October 30, 2009 at 08:57 AM PDT #
bakvas
Posted by bakvas on November 18, 2009 at 11:23 PM PST #