Thursday, February 17, 2011

which library better for faster java application swt or swing?

which library better for faster java application swt or swing?

From stackoverflow
  • According to wikipedia there is no clear winner (although you can edit that if you want). Inevitably, you can write benchmarks which will show either much faster that the other. Swing has more freedom to optimise on the Java side of things. SWT can allow more optimisations to occur within the windowing system.

    Probably the bigger impact on performance is going to come from how your application behaves. Concentrate on getting your code clean (and do a little profiling when necessary).

    Dimitry Z : If this is the case, isn't Swing with winner since it is most capable of simulating the OS' theme?
    gizmo : Hell, no! SWT use native widgets, so you won't be able to behave better with Swing.
    Tom Hawtin - tackline : I believe Swing has a better track record of keeping up with native widgets. It doesn't have to deal with fixing up native APIs. Where Swing fails in that regards is where you have pluggable engines, as on Linux.
    shemnon : Ok, Tom, Wikipedia has been fixed at your behest. http://en.wikipedia.org/w/index.php?title=Swing_(Java)&oldid=245060801 ;)
    shemnon : We'll see how long it lasts :)
  • hi there,

    there are more applications written using swing than SWT over the years. But the user-friendliness of SWT on windows is superior compared to Swing. But, there are exceptions(http://www.amazon.com/Rich-Client-Programming-Plugging-NetBeans/dp/0132354802) .

    There is a bigger community of RCP apps developed using SWT. Although the RCP applications using Netbeans is NOT as big, that is considerable.

    With Java 6 UPDATE 10 coming up soon, the performance of Swing apps should be pretty good. That said, that performance improvement might apply to SWT apps as well.

    BR,
    ~A

  • Several years ago Swing was slow so SWT was developed to make native API calls on systems. However, Swing performance has greatly improved and this is no longer the case. SWT is non-standard, while Swing is officially part of the Java spec. JavaFX will also be built on top of Swing. Unless your job requires writing Eclipse plugins, I would use Swing.

    To see a really good app developed in Swing, take a look at Jetbrain's Java IDE. You can try it for 30 days.

    http://www.jetbrains.com/idea/

    Of course, Sun's Netbeans is a pure Swing app too and it's free.

    http://www.netbeans.org/

  • There is no slow swing application. Just poorly written. And this also apply for SWT. The most application make better responses because of eclipse core architecture. Before J6 there were several problems with gray windows during unresponsive periods but this is quite solved using fully double buffered approach in swing PLAFs. There is no better UI framework. There is only better written program which appropriately uses multi-threading to avoid unresponsiveness of UI. Personally I prefer Swing :)

  • "faster" is subjective. Both can run fast, but it's easier to do something dumb to shoot yourself in the foot with Swing and make it feel slow.

    That said though, I find Swing easier to work with at a code level than SWT.

  • Today, both frameworks are fast. I suggest to check these criteria:

    1. SWT is more simple to use than Swing (especially if this is your first UI)
    2. Swing is older and you can find more components
    3. If you also use JFace, you will find many powerful widgets that work out of the box (where you would need a lot of additional configuration in Swing).
    4. Swing is available anywhere, SWT is not
    5. SWT is developed actively, you have the source and bugs are fixed quickly. Swing hasn't been touched in years, then there was suddenly a big update for Java 6. If you have an issue with Swing, well, Sun probably doesn't care.
    6. If you choose Swing, use a framework like SwingX. This will make your life much more simple.
  • Technological decision towards the widget toolkit are pretty thin ice in my eyes. The amount of work you'd have to deliver when it comes to the application framework is considerable and much more decisive IMHO. I believe that the only argument that's in favor of SWT is it's native L&F. On the other hand most UI's tend towards non-native L&F nowadays. You clearly see this in the trend for Eclipse RCP apps to use the forms framework which paints custom gradients and sections and is no native interface in any way (the same applies to e4, the eclipse v4 elaboration project). To sum up, If RCP's an option in your project, I'd use Eclipse RCP (which is SWT). The completeness, vivacity and tempo this platform has is unbeatable. If RCP's not an option, Spring RCP looks pretty convincing to me (which is Swing based).

0 comments:

Post a Comment