SwingWT VERSION 0.85
The Swing API over SWT lib
=============================

Copyright(c)2003-2004, R. Rawson-Tetley

Ok, this thing isn't complete - but it's not far off! Implementation of some 
things may be inadequate and you may find some stuff missing. If you do, 
*please* let me know.

What this gives you is maybe 90% of the Swing/AWT API, some neat tricks and 
the whole thing is simple, and pretty efficient (you lose a negligible amount 
of performance and pay a small memory cost going through this wrapper, but of 
course - you make it up with the native components, so that's ok :-))

I made this because I wanted to be able to compile my apps natively under Linux
with GCJ (which does not support Swing) and have access to GTK2. The SWT API is
frankly (in my opinion) very poor, and I like Swing, I know Swing and I'm
very happy with Swing - it just looks rubbish (again, in my opinion). It's just
happy accident that what I also started was a completely free Swing 
implementation.

You can accomplish the same with Windows (native Java apps with the Win kit
and GCJ). Go to http://www.thisiscool.com/gcc_mingw.htm for a complete
compiler toolchain using SwingWT as the Swing and AWT implementation.

There's probably a few bugs in there as well, so help me out if you can :-)

Outstanding Items:
=========================================================

*. Printing support
*. Drag and drop support
*. Complete Java2D support
*. Full Clipboard/DataTransfer support (needed for DnD)
*. Full StyledDocument support
*. Probably other little bits that will get noticed eventually

New Bits
=============================================

The following are useful items that people have either asked me for, or I 
thought belonged in SwingWT, even though they aren't part of Swing. You don't 
have to use them and I wouldn't recommend you do if you want Swing 
compatibility. However - they give you some pretty neat stuff you wouldn't be
able to get otherwise!

*. JCoolBar - a Swing-like wrapper around platform CoolBar support (the coolbar
   is a container generally used with multiple toolbars to allow them to be 
   moved around)
*. JClosableTabbedPane - a Swing wrapper with the same API as JTabbedPane but 
   has a close button on the tabs, and you can catch close events.
*. ValidationGroup - a full-fledged validation utility to allow you to have 
   error icons appear as users type to show validation problems. Similar to the    
   C# WinForms class called ErrorProvider.
   Rather than breaking existing components, Validatable components have that 
   prefix - eg: ValidatableJTextField, ValidatableJComboBox etc. Their 
   interface remains the same.
*. TableLayout - an AWT layout that works like an HTML table. It can also lay 
   out components from top to bottom across the screen like newspaper columns.
*. JLookupPopup - a fast alternative to JComboBox
*. JTaskTrayItem - a component for creating icons with popup menus in the 
   Windows tasktray/GNOME system notification area.

Using in your applications
==========================

To use in your applications, add the swingwt.jar lib to your classpath and do a
search and replace. You want to replace all occurrences of javax.swing with 
swingwtx.swing, and java.awt with swingwt.awt. That's it!

You can use a preprocessor, bytecode assembly, a sed/grep script or even a 
simple Ant token replace to do this.

Of course, (Linux) you'll need the swt.jar and swt-pi.jar (optionally 
swt-mozilla.jar) referenced in your classpath (and the appropriate 3/5 .so 
files in your lib path) so the library can access SWT. Windows users just 
need swt.jar on the classpath and 2 swt dlls on their lib path. See the bin 
directory for example startup scripts/batch files.

Building a Swing/AWT Replacement
================================

The Ant script supplied with SwingWT is now capable of making java/awt and
javax/swing packages for use with free virtual machines (such as Kaffe,
SableVM and GIJ). To do this, set the "sun" property to no - eg:

ant -Dsun=no

The resulting swingwt.jar will contain java.awt/javax.swing packages
instead. Use your VM's bootclasspath parameter to load swingwt.jar first to
make it take precedence over any AWT/Swing implementation already in your VM's 
class libraries.

Building natively
=================

A native Makefile is supplied for GCJ. 

Everything you need is included in the distribution - simply run "make"
to build lib/libswingwt.so and lib/libswt.so (dependent on platform). 

Link your native programs against these two libraries (don't forget to 
include swingwt.jar on the classpath when you do the GCJ object compile!).

Demo
====

A demo frame demonstrating some functionality can be seen by running the
appropriate script for your platform in the bin directory. The same demo using 
Swing is also available from this directory so you can compare. In addition, 
there is a simple browser demonstration using Swing and SwingWT, an MDI demo 
and a demonstration of the ErrorProvider class. SwingSet2 is also included, 
running with SwingWT.

Browser Note:
=============
To use JEditorPane under Linux/GTK2, you need Mozilla 1.4 - see the file FAQ 
for further help. If you attempt to use JEditorPane without the machine being 
setup correctly, instructions on how to do this will be sent to stdout.

Help!
=====

Any help with coding/patches would be very much welcomed. Note also that I 
develop under Linux/GTK2 so there may be some problems with other native kits 
(I doubt it, but there might be).

If this is not the project you are looking for, and you want portable SWT 
(ie. Swing renderer for SWT), then there is a SourceForge project called 
SWTSwing run by a nice bloke called Chris - that's probably what you want 
(http://swtswing.sourceforge.net). 
Have fun!

Contact me at:
bobintetley@users.sourceforge.net
