Oh SWT, how I loathe thee. Let me count the ways.

Some reasons why SWT frustrates me in no particular order:

  • A column title in a table header has the same justification as the contents of the column.

  • Common style constants have common (and therefore ridiculously vague) descriptions in the documentation. Next to no effort was put in to provide more detailed descriptions in classes which will commonly use those styles. In fact, most if not all of the widgets even specify a list of best fit styles for that widget but don't elaborate on what, if anything, something like SHADOW_IN might do when applied.

  • Common style constants period. If I enjoyed writing painful to maintain code, my language of choice would not be Java. It just makes so much more sense to have a Style object that you can set properties on. Would that really be any different that the GridData class? Internally, it could pretend to be all 1337 and do everything with bitmasks like it was written in C, but I shouldn't have to see fifty million constants. It's no wonder Sun refuses to touch SWT with a ten foot pole. But I suppose I shouldn't complain, they could replace GridData with 25 more common style constants.

  • Virtually every class has the following warning (or a slightly different one with the same meaning): 'IMPORTANT: This class is not intended to be subclassed'. If that's the case, Java has a keyword for it. It's called final.

  • Out of the box, my apps don't look right on Windows. Seriously...I have to manually set the margins on the Layout for it to look native. Why isn't native the default? The default width on a Shell with a GridLayout is at least twice the size of the native window border. Funny though, the window border with the defaults looks identical to that of a Swing window. And here I thought SWT was supposed to be 'better'.

  • EVERYTHING is a SelectionEvent. Clicking on a Button, okay. I can shift my mindset to see how that is a selection. You are 'selecting' that Button when you click it. But will someone please tell me, honestly, if I press ENTER in a Text field, how is it that I just defaultSelected it? In fact, I would have already had to select it a while a go to type ENTER into it in the first place. And defaultSelected? To me that sounds like a widget has default focus, not the user did something that can't possibly be considered default by any definition of the word. I'm very curious why SWT felt ActionEvents were the devil, as they make so much more sense.

  • The GridData class has no methods, just public fields and constructors. And yet they aren't supposed to be reused? Weird that their siblings RowData and FormData don't have this problem. Oh, and as Jesse mentioned, they also have some convenience style constants that don't work in obvious cases.

Sorry, I just felt the need to rant. It seems that working with SWT has that affect on people.