Swogl

Swing meets JOGL


General information



Swogl is a library for displaying and interacting with Swing components in 3D using JOGL. The most important classes are
Nearly all sorts of Swing components can be added to a SwoglComponent. The components may be freely arranged in space, and may consist of arbitrary geometry.



News


2009-10-27: Swogl hosted at Google Code - License changed to Lesser GPL - Swogl Forum opened 2009-08-20: Swogl 0.1 (alpha) released
(Change log)



Important notes




Demos and screenshots



Here are some screenshots of Swogl in action. All these demos are contained in the demo package that is available in the Downloads section


thumbnail Hello Swogl - A screenshot of a minimal Swogl demo application: A small SwoglComponent containing a JTextField and a JButton.
thumbnail A screenshot of a general Swogl demo application. It shows several SwoglComponents with a variety of Swing components. It allows changing the Look And Feel of the application, and selecting different implementations of 3D layout managers, which arrange the SwoglComponents in space.
thumbnail A small demonstration of one possible application of Swogl: An image viewer that allows selecting a directory containing images, and lets the user browse through the images using the FlipLayout3D layout manager, which lays out the components in this "iPhone music browsing" style.
thumbnail Swogl can display the Swing components on arbitrary geometries. In this example, the Swing components are projected onto the famous Stanford Bunny, which was read from an OBJ file.
thumbnail In this example, Swogl is used to display a JTable with 180 rows and 50 columns on a SwoglComponent that provides 4000x3000 pixels. The user may examine the table using a "magnifying glass".

Note that this demo is quite demanding concerning the processor- and graphics card power and memory. However, on an NVIDIA GeForce 8800 I managed to display a JTable with 375 rows and 100 columns on a SwoglComponent with 8000x6000 pixels.
thumbnail This was actually only an experiment, but somehow looks fancy, so it is also provided in the demos package: Several HTML pages are shown on SwoglComponents using JEditorPanes. The SwoglComponents are laid out like the pages of a book, and pressing the button in the lower corner animates the SwoglComponent like the page of a book that is turned.



Download



Swogl-0.1.zip The archive contains the JAR files for Swogl version 0.1. The source code and documentation is also contained in the respective JAR files.

The archive also contains the JAR file of https://vecmath.dev.java.net/ which is required for Swogl.

In order to use Swogl, you also have to download version 1.1 of JOGL for your target platform from https://jogl.dev.java.net/ and include the JOGL files from the archive into your project.

Please note that JOGL 2.0 is not yet supported.
Swogl-0.1-Demos.zip An archive containing the source code and data required for the Demos




Documentation


You may browse the Swogl documentation or obtain it with the Swogl package from the Downloads section.



General information on using Swogl



As mentioned above, Swogl is currently provided as an alpha version. Only limited parts of the API have been made public, since parts of it may still change. However, using the public parts of the API is straightforward. You may want to have a look at the demos that may be obtained in the Downloads section, and which might serve as starting points for own applications.


One point to keep in mind might be the threading issues: For Swing, there is the Single Thread Rule, as described in detail in this Article about Threads and Swing. The rule states that...

Once a Swing component has been realized, all code that might affect or depend on the state of that component should be executed in the event-dispatching thread.

The same rule applies for SwoglComponents. For example, modifying the position of a SwoglComponent in 3D, or adding or removing SwoglComponents from a SwoglContainer should always be performed on the event-dispatching thread. In most cases, it is quite easy to obey this rule, by simply wrapping the respective operation in a Runnable that is executed via the SwingUtilities:
SwingUtilities.invokeLater(new Runnable()
{
    public void run()
    {
        swoglContainer.add(swoglComponent);
        swoglComponent.setTransform(matrix);
    }
});
This information might be particularly relevant for you if you intend to animate SwoglComponents, for example, when writing an own LayoutManager3D.