Swogl
Swing meets JOGL
Swogl is a library for displaying and interacting with Swing components in 3D using JOGL.
The most important classes are
- SwoglContainer, which provides an OpenGL component for rendering
- SwoglComponent, which may be added to a SwoglContainer and displays
arbitrary Swing Components in 3D
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
-
The source code of Swogl is now hosted at the
Google Code Swogl project page.
The pre-built binaries, screenshots and demos that are published here
will be updated regularly.
-
The license of Swogl has been changed to the Lesser GPL, allowing to use
Swogl also in commercial applications.
-
A forum for feedback and discussion about future development has been opened: Visit the
Swogl forum.
2009-08-20: Swogl 0.1 (alpha) released
-
After some early previews of Swogl, an early alpha release is now
available. Additionally, the source code of Swogl has been released.
The binaries and the source code may be obtained in the
Downloads section
(
Change log)
Important notes
-
Swogl is still under construction. There are still many open questions
about how to give the user of the library the possibility to configure
the interaction according to his own needs. The possible layout and
interaction methods for a 3D user interface are unlimited, which is
fascinating as well as challenging concerning the API design.
Thus, the API of Swogl may still change!
Swogl is currently provided as an alpha version, and the
API exposes the most important features. But users should not
rely on possible implementation details. For example, the
implementations of the 3D layout managers should be considered
as preliminary versions, which have to be extended and improved
in order to be more universally applicable.
If you have any comments, contributions or suggestions
concerning Swogl, please contact me, or
post them at the Swogl forum
-
Known bugs and limitations:
- Placement problems when using JPopupMenus and sub-JMenus
- Potential placement problems for the popup menus of JComboBoxes (although they work in general)
- Resizing JInternalFrames does not work
- Minor rendering artifacts when moving JInternalFrames
- Minor rendering artifacts when using JPopupMenus
- Recursive SwoglContainers (i.e. using a SwoglContainer on a SwoglComponent) are not officially supported
Here are some screenshots of Swogl in action. All these demos are contained in
the demo package that is available in the
Downloads section
|
Hello Swogl - A screenshot of a minimal Swogl demo application: A small
SwoglComponent containing a JTextField and a JButton.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
| 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
|
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.