SWT vs My Sanity: Round 2

I'll try to keep my rants on SWT to a minimum, but I feel the need to provide information to others who run head first into the brick wall that is SWT. I remember reading a comparison of Swing and SWT some time ago and it clicked into my mind today. Despite Google's best efforts, I couldn't find the article but I'll give you the conclusion:

SWT is great and fast as long as you want to do small, simple things, one time.

Bearing that in mind, parts of the framework make a little more sense. But then again, lots of things make sense when you don't plan to ever make anything complex, scalable or maintainable. Large projects need Swing, or at least, they need something that feels Object-Oriented; Something that's built with best-practices and patterns like MVC in mind.

Today's SWT Strangeness:
A Table widget only fires events to a registered MouseListener iff the MouseEvent occurs inside the table.

Doesn't seem strange at first save for the following problem: The table headers are not inside the table.

In order to gain information on table headers being clicked you need to use a SelectionListener(groan). SelectionEvents are only fired by mouse clicking with the left mouse button. But can't you add a MouseListener to the TableColumn and access the header? No, you can't. The only Table-related widget that supports MouseListeners is Table. I even tried using the base Listener (which you can add to anything), and seeing if perhaps handleEvent() might shed some light on things. Wrapping the event in a MouseEvent I dumped the details of the MouseEvent to my console. At first it was exciting. I had beaten SWT. But no, just like that SelectionEvent, those events only show up with you left-click. In the event that you wanted to provide a complex interface that behaves different when you right click or ctrl-click on a table header, come running back to Swing before your boss has his heart set on SWT.

Tomorrow's SWT Strangeness:
Table Implosion

Stay Tuned...

Try SWT Design Patterns. It offers the following

- Focus on what is done than how is done.
- Source code compatibility for changes in future SWT versions.
- Potential for easy migration to another similar GUI package.
- Simple to write standard enterprise software quickly.
- Easy to read and maintain your source code.
- Less coding errors.
- Shorter programs.
- Open source.
- Absolutely free!

SWT Design patterns provide the following special features;
- Simple standardized event handling.
- Automated sash operations.
- Specification based form layout handling.
- Simple menu and toolbar support.
- No hassles with thread ownership!

SWT Patterns is available at