Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT Advocacy
SWT Advocacy [message #459413] Tue, 09 August 2005 09:08 Go to next message
Neil Bartlett is currently offline Neil BartlettFriend
Messages: 93
Registered: July 2009
Member
Hi,

I'm trying to introduce Eclipse RCP as a platform for developing
applications at my workplace, however I'm encountering a lot of resistance
from the anti-SWT crowd. Does anybody know of some good documents that
advocate SWT or any objective comparisons of SWT versus Swing? Too many of
the arguments I've read on blogs etc have bordered on religious diatribes
- one might even say that the Swing supporters "doth protest too much"!

The main points that come up over and over again are these:

1) "SWT was originally written because Swing was slow, but Swing isn't
slow any more so we don't need SWT." Does anybody have any actual figures?

2) "The SWT API was designed to be very close to the Win32 API, so porting
it to other platforms is very hard." I don't know if that's true or not,
nor if I, as a user of SWT, should even care.

2) "SWT is not as portable as Swing." True it doesn't support every
platform supported by Java, but on the other hand we don't have any plans
to roll out IRIX to our desktops....

3) "Swing's table and tree controls are more advanced", this mostly seems
to be around customization of the column header controls (eg tool tips,
popup menus, etc). However they have to resort to nasty hacks to do tree
tables!

4) "Because SWT controls are added to their parent at construction time,
you have to create controls in the order that they appear on the screen."
Is that true?

5) "Explicit disposal of images etc creates the potential for memory leaks
- this is not necessary in Swing." I don't think this is all that
different from remembering to close file handles and database connections
- we don't rely on GC for that either.

Can any of the SWT gurus offer any responses to these points, and can you
help me to enumerate the advantages of SWT?

Thank you,
Neil Bartlett
Re: SWT Advocacy [message #459415 is a reply to message #459413] Tue, 09 August 2005 09:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

Hi Neil,

here some answers from a Swing and SWT user:

> 2) "The SWT API was designed to be very close to the Win32 API, so
> porting it to other platforms is very hard." I don't know if that's true
> or not, nor if I, as a user of SWT, should even care.
Simply do not care :) In practice you have to learn an API. It is not
important, how far or close to Win32 it is, as long as it is easy to
understand and not cryptical.


> 3) "Swing's table and tree controls are more advanced", this mostly
> seems to be around customization of the column header controls (eg tool
> tips, popup menus, etc). However they have to resort to nasty hacks to
> do tree tables!
This is right at least for the Table widget, as one also can see looking
at all the table questions in this forum. This particular problem was
solved by my KTable :)

> 4) "Because SWT controls are added to their parent at construction time,
> you have to create controls in the order that they appear on the
> screen." Is that true?
No, that is wrong. You can move your widgets where ever you want using
control#moveAbove and moveBelow API (or so).


> 5) "Explicit disposal of images etc creates the potential for memory
> leaks - this is not necessary in Swing." I don't think this is all that
> different from remembering to close file handles and database
> connections - we don't rely on GC for that either.
This has never been the problem for me. It even helps you because you
realise the "ressource hungryness" of your application... There also
exist tools to see what is going on (e.g. SLeak).


Hope that helped a bit.

Cheers,
Friederich

--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: SWT Advocacy [message #459459 is a reply to message #459413] Tue, 09 August 2005 12:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gregoire.diboula.gmx.net

I use SWT for one single reason: the resulting GUI looks professional in
the first place. If you are not an expert in GUI design like Karsten
Lentzsch (the Jgoodies guy), building a professional looking GUI using
Swing is more difficult than building the application itsself.
Re: SWT Advocacy [message #459462 is a reply to message #459413] Tue, 09 August 2005 14:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hcs33.egon.gyaloglo.hu

Hi,

> 1) "SWT was originally written because Swing was slow, but Swing isn't
> slow any more so we don't need SWT." Does anybody have any actual figures?

I think it depends on what platform do you use. We do some measurement on
about two years ago (using jdk 1.4.1 for Swing and SWT for Eclipse 2.1) on
Windows 2000. It was a very simple test application (a table and a tree: a
test using with 100 items on them and another using 5000 items). Our results
was:
- SWT was slower on building the gui in the later case because it creates
all table and tree items. In later SWT versions the virtual flag for table
helps that I think.
- After displaying the gui, the SWT app was faster on scrolling both the
table and tree. The processor consuming was about 30%. In the Swing app,
processor consuming was about 98% when scrolling.
- The SWT app uses less memory than the Swing one (as far as I remember 14MB
vs. 21MB).

>
> 2) "SWT is not as portable as Swing." True it doesn't support every
> platform supported by Java, but on the other hand we don't have any plans
> to roll out IRIX to our desktops....
>

When you want to develop applications for multiple platforms you have to
test your code in every platform. In both SWT and Swing there are some
different behaviours. Most of them are minor problems but can be annoying if
you don't test.

>
> Can any of the SWT gurus offer any responses to these points, and can you
> help me to enumerate the advantages of SWT?
>

Personally I think both Swing and SWT are good toolkits but with different
purposes. The main difference is that SWT uses 'native' platform widgets
when they are available, Swing draws everything by itself. The important
results (for me) of this differences are:
1. Swing gui-s are much more easily can be customized.
2. In Swing the data model and view separation is a powerful tool is you
need to work with large data sets.
3. SWT gui-s are 'native' gui-s: they look and behave as a native
application - Swing have to emulate the look and feel of the platform.
4. SWT gui-s are more 'responsible' - at least on Windows (I do not test it
for another platforms), as our test shows. It is because the platform draws
the gui not the java application itself.

HTH,
Regards,
Csaba
Re: SWT Advocacy [message #459463 is a reply to message #459415] Tue, 09 August 2005 14:29 Go to previous messageGo to next message
Henrik Skovgaard is currently offline Henrik SkovgaardFriend
Messages: 84
Registered: July 2009
Member
> This is right at least for the Table widget, as one also can see looking
> at all the table questions in this forum. This particular problem was
> solved by my KTable :)

Haven't looked that much into KTable yet, but I think I get some exceptions
in the examples.. :-)

Exception in thread "main" java.lang.NullPointerException

at de.kupzog.ktable.KTable.onKeyDown(KTable.java:1609)
Re: SWT Advocacy [message #459467 is a reply to message #459463] Tue, 09 August 2005 16:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

> Exception in thread "main" java.lang.NullPointerException
>
> at de.kupzog.ktable.KTable.onKeyDown(KTable.java:1609)

What did you do to cause this exception? Which platform? Could not find
out what happens with the given information. Thanks for the report anyway :)

Friederich

--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: SWT Advocacy [message #459685 is a reply to message #459413] Sat, 13 August 2005 10:18 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 97
Registered: July 2009
Member
"Neil Bartlett" <neil@integility.com> wrote in message
news:bf9a66be186efd912446004c6935fa40$1@www.eclipse.org...
>
> 1) "SWT was originally written because Swing was slow, but Swing isn't
> slow any more so we don't need SWT." Does anybody have any actual figures?

It isn't the speed that's causing problems. It's the POOR shoddy
implementation of Swing.
If you write COMMERCIAL s/w in Swing and try to sell to Windows users,
nobody will be interested! Programs written in Swing even doesn't support
cut & paste functions. If you are writting for Linux/Unix systems only,
then Swing might be a choice. After all, they are for hackers only. No one
care about GUI. If you are for Windows/Mac users, Swing is definitely
not a choice. I don't see any company developing commercial or
enterprise s/w using Swing! You build a house out of shody material.
Then your house is cheap shoddy building. The same applies to your s/w.

> 4) "Because SWT controls are added to their parent at construction time,
> you have to create controls in the order that they appear on the screen."
> Is that true?

Not necessariliy in appearing order. But you have to observe hierachical
order since you always need parents.

Cheers for SWT and pray for Swing.
Re: SWT Advocacy [message #459687 is a reply to message #459685] Sat, 13 August 2005 14:08 Go to previous messageGo to next message
Stefan Zeiger is currently offline Stefan ZeigerFriend
Messages: 102
Registered: July 2009
Senior Member
Joe Smith wrote:

> not a choice. I don't see any company developing commercial or
> enterprise s/w using Swing! You build a house out of shody material.
> Then your house is cheap shoddy building. The same applies to your s/w.

Well, to give an example, we are building the client app for the XMS
enterprise integration platform which we are developing at Commerzbank
using Swing. This started as an in-house project but is now also being
sold to other corporations.

Of course, we started building the client back in 2001. If we were
starting now, it would most probably be built as an RCP application
using SWT :-)

--
Stefan Zeiger - Developer of Novocode Application Framework
Build SWT-based MVC GUIs via XML: http://www.novocode.com/naf/
Re: SWT Advocacy [message #459689 is a reply to message #459687] Sat, 13 August 2005 22:32 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 97
Registered: July 2009
Member
"Stefan Zeiger" <szeiger@novocode.com> wrote in message
news:ddkup6$fro$1@news.eclipse.org...
> Joe Smith wrote:
>
>> not a choice. I don't see any company developing commercial or
>> enterprise s/w using Swing! You build a house out of shody material.
>> Then your house is cheap shoddy building. The same applies to your s/w.
>
> Well, to give an example, we are building the client app for the XMS
> enterprise integration platform which we are developing at Commerzbank
> using Swing. This started as an in-house project but is now also being
> sold to other corporations.
>
> Of course, we started building the client back in 2001. If we were
> starting now, it would most probably be built as an RCP application using
> SWT :-)

It will depend on your GUI requirement. If you write systems with simple
stuff,
Swing may work. Also if you have very special s/w with users having no
alternatives,
they may accept. Oracle install system seems to use Swing! Obviously,
it's very user-unfriendly, ugly, and cranky!

First of all, even "cut & paste" doesn't work in Swing!
If you are happy with Swing, I suspect your s/w
may not need high quality GUI interface.

Best regards.

>
> --
> Stefan Zeiger - Developer of Novocode Application Framework
> Build SWT-based MVC GUIs via XML: http://www.novocode.com/naf/
Re: SWT Advocacy [message #459762 is a reply to message #459689] Mon, 15 August 2005 20:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: callum.devnet-uk.net

Joe Smith wrote:
> "Stefan Zeiger" <szeiger@novocode.com> wrote in message
> news:ddkup6$fro$1@news.eclipse.org...
>
>>Joe Smith wrote:
>>
>>
>>>not a choice. I don't see any company developing commercial or
>>>enterprise s/w using Swing! You build a house out of shody material.
>>>Then your house is cheap shoddy building. The same applies to your s/w.
>>
>>Well, to give an example, we are building the client app for the XMS
>>enterprise integration platform which we are developing at Commerzbank
>>using Swing. This started as an in-house project but is now also being
>>sold to other corporations.
>>
>>Of course, we started building the client back in 2001. If we were
>>starting now, it would most probably be built as an RCP application using
>>SWT :-)
>
>
> It will depend on your GUI requirement. If you write systems with simple
> stuff,
> Swing may work. Also if you have very special s/w with users having no
> alternatives,
> they may accept. Oracle install system seems to use Swing! Obviously,
> it's very user-unfriendly, ugly, and cranky!
>
> First of all, even "cut & paste" doesn't work in Swing!
> If you are happy with Swing, I suspect your s/w
> may not need high quality GUI interface.
>
> Best regards.
>
>

If anyone has a spare five minutes, they should write a Swing -> SWT
converter. Gives you something to occupy your time. ;)
Re: SWT Advocacy [message #459765 is a reply to message #459762] Mon, 15 August 2005 22:17 Go to previous message
No real name is currently offline No real nameFriend
Messages: 97
Registered: July 2009
Member
"Callum Urquhart" <callum@devnet-uk.net> wrote in message
news:ddqu6b$d03$2@news.eclipse.org...
> Joe Smith wrote:
>>
>
> If anyone has a spare five minutes, they should write a Swing -> SWT
> converter. Gives you something to occupy your time. ;)

There are a couple of things that makes impossible to write converter.
I migrated AWT program to Swing easily with Adaptor Design Patterns.
Using design patterns, we can make source code nearly identical, if
not 100%.

I've working on making AWT/Swing to SWT. But found the following
obstacles;
1. SWT has mandatory parent ownership. Must create object in
hierarchical order. But AWT/Swing programs are not written this
way!
2. Gridbaglayout is not quite compatible between them.

I already have SWT patterns. This will make AWT/Swing programmers
easy to write SWT programs. But still need documentation!

Regards.
Previous Topic:Console is not available
Next Topic:How to control browser widget to print
Goto Forum:
  


Current Time: Sat Apr 27 05:11:05 GMT 2024

Powered by FUDForum. Page generated in 0.03719 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top