Here are all the code snippets from the demo application: click on their name to see the corresponding source code.
To see them running, download the DJ Native Swing distribution and launch the demo application (you can also see the source code of the snippets with syntax highlighting in the demo).
This is a simple example that shows the basic configuration of an embedded web browser component.
Set any HTML content to the web browser.
Control the navigation happening in the web browser from the Java application. This allows to block certain links and/or the creation of new windows, or to open links and/or new windows elsewhere.
Access and modify the cookies set by the various browser instances.
Define HTTP headers and/or POST data to send along with the HTTP navigation request.
Load web pages from the classpath with the help of the embedded simple web server.
Dispose a web browser giving the current page the opportunity to ask for confirmation.
Toggle edition mode of a web page by accessing the Mozilla interfaces using XPCOM.
Modify the browser's download manager using Mozilla XPCOM.
Modify the browser's decorator, to add our own menus and buttons.
Capture the image of the page, including the portions that are outside of the viewport of the main document.
Graphically edit some HTML, get and set the HTML content, using the FCKEditor implementation.
Graphically edit some HTML, get and set the HTML content, using the CKEditor implementation.
Graphically edit some HTML, get and set the HTML content, using the TinyMCE implementation.
Track whether the editor was modified since the last time its content was set.
Display some content with syntax highlighting from one of the available languages (C++, C#, css, Delphi, Java, JS, PHP, Python, Ruby, SQL, VB, XML, HTML).
Load a movie/sound file to an embedded multimedia player.
Use a file dialog or a directory dialog, and customize them to your needs.
Constrain the visibility to superimpose Swing and native components. Note that Mac only supports shapes resolving to a single rectangle.
Defer destruction until finalization to add/remove the same component. It is not destroyed when removed but on disposeNativePeer() or garbage collection.
Use a proxied component hierarchy for the native components to allow re-parenting and change of component Z-order. Note that Mac only supports shapes resolving to a single rectangle.
Create a thumbnail by painting a native component to an image.
Simulate alpha blending of a Swing component over a native component. This works rather well over static content. Note that Mac only supports shapes resolving to a single rectangle.
Present the life cycle of a component and when method calls happen. Also highlight how runInSequence(Runnable) can be useful, and for special needs how to use initializeNativePeer().
Attach a listener for key and mouse events, and go as far as replacing the web browser popup menu with a Swing one.
Get the file type associations, and use them to launch files.