aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes SWT on any other IDE? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "SWT on any other IDE?" Watch "SWT on any other IDE?" New topic
Author

SWT on any other IDE?

Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
I've heard that SWT can only be developed in Eclipse... Is it true? There should be some kinda SWT package available for Swing developers to develop in some other IDEs, not just in Eclipse...

Correct me, if I am wrong....

I was a die-hard fan of Swing in the past... But due to the performance and many other weaknesses of Swing, it seems like Swing is dying, at least in Thailand, where I am currently residing... As I've heard that SWT is the enhancement of Swing and its performance is far beyond that of Swing, I am really interested in SWT, even though it might not be directly related to my job functions... :roll:

Any comments are welcome....


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Rob Warner
author
Ranch Hand

Joined: Apr 22, 2004
Posts: 50
Somebody was misleading you; you can develop in SWT using any IDE, or any editor and command line tools. All you need is the SWT java classes and the platform-specific SWT native libraries. The eclipse.org Web site offers these files as a separate download. We cover this on pages 23-25 of The Definitive Guide to SWT and JFace.

HTH
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

it seems like Swing is dying, at least in Thailand


SWing is dead world wide.

Author,
I would like to know whether SWT will be included in Core Java API.


Groovy
Rob Warner
author
Ranch Hand

Joined: Apr 22, 2004
Posts: 50
I'm curious why you'd say that Swing is dead worldwide. As an SWT kind of guy, I now find myself in the curious position of defending Swing, but Swing is far from dead IMHO. Many tools continue to be written in Swing, including Sun's own IDE (NetBeans).

I will be surprised if SWT is folded into the core Java API, at least for the forseeable future.

I do think that SWT is a technically superior direction, since it uses native widgets. I think Swing will continually fight an uphill battle, since all their widgets draw themselves? What battle? Both performance and visual integration.
Gary Down
Ranch Hand

Joined: Apr 09, 2004
Posts: 46
As a newbie to JAva/Swing etc...

I am only just venturing into anything more than the simplest frames wth swing. Now I read comments about swing being dead/dying.

Should anyone new to all this be learning in a different direction other than swing?
What is SWT?

Gary,
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Gary Down:
As a newbie to JAva/Swing etc...

I am only just venturing into anything more than the simplest frames wth swing. Now I read comments about swing being dead/dying.

Should anyone new to all this be learning in a different direction other than swing?
What is SWT?

Gary,


Swing is not dead. In fact, some pretty cool improvements were made to swing with the new JDK 1.5. The problem is that Desktop Application Development has been in a recession since web apps have become the defacto standard in business.

Sun is doing it's part to try and change that with the Java Desktop community and what I'm hearing on the grapevine is that M$ Longhorn is supposed to bring back desktop development in some shape or form.

I'm not sure how SWT fits into the scene right now or the future. Hopefully the Rob can enlighten us on that a little bit.


GenRocket - Experts at Building Test Data
Rob Warner
author
Ranch Hand

Joined: Apr 22, 2004
Posts: 50
The desktop never dies at all; I think Gregg's description of "a recession" is perfect. It seems the web app vs. desktop app debate has followed a similar path as that of handheld computers. When Palm Pilots came out, people were willing to accept reduced functionality to get the convenience that the small form factor offered: little memory, primitive input, no color, slow processors. After a time, however, people demanded more and more, and now with a collapsible keyboard, a high-end handheld can be (and sometimes is) used as a laptop replacement.

In the Web's glory days, people accepted the dullness of the client in order to get the convenience of no distribution, no new app to learn, etc. Now, people are back to demanding a richness in their web applications that HTML cannot provide.

In this context, desktop apps are storming back. Also, both Linux and Mac OS X are starting to take some of the desktop market. True, the vast majority of desktops are still Windows, but Linux and Mac represent several million desktops--too many to ignore. Writing desktop apps in Java allows the same app to run on any of the three platforms (as well as many others). Using SWT and/or JFace in those Java apps ensures that the apps will look, behave, and perform like native apps.

I think the Java desktop space will continue to grow.
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Pradeep Bhat:

Author,
I would like to know whether SWT will be included in Core Java API.


Hi Pradeep,
IMO, I guess it cannnot be included in Core Java API... Coz the main concept of Java is platform-indepedent, but the SWT package must contain java classes and the platform-specific SWT native libraries. So even though the first requirement(java classes) can contain in Core Java API, the latter requirement(platform-specific SWT native libraries) might be difficult for Sun to make decision to include platform-specific things in its Core Java API...

It's just my own opinion.. There might be some other ways to accomplish those things....
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Rob Warner:
Somebody was misleading you; you can develop in SWT using any IDE, or any editor and command line tools. All you need is the SWT java classes and the platform-specific SWT native libraries. The eclipse.org Web site offers these files as a separate download.
HTH


platform-specific SWT native libraries So, Mr.Rob, does it mean that we need different native libraries for different platform like Windows, Linux and Mac OS? If so, it seems it is breaking the "Write Once, Run anywhere" motto of Java... Or we just need to inlude all platform-specific SWT native libraries for Windows, Linux and Mac OS in the same JAR of my SWT application, then it is some kinda platform-indepedent and it can run on any platform...

Correct me, if I am wrong... As I have mentioned above, I used to be a die-hard fan of Swing and now it seems that SWT might make my Swing skill resurrect again...
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

My opinion is Swing applications are very slow. You need lot of memory to run them. If you have less memory they take a lot of time to respond. If I click a button, I could as well go and have cup of cofee before the ButtonPressed event gets called.

I am not aware of Swing features in Java 5 (Java 1.5) but hope that it does well.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

IMO, I guess it cannnot be included in Core Java API... Coz the main concept of Java is platform-indepedent, but the SWT package must contain java classes and the platform-specific SWT native libraries. So even though the first requirement(java classes) can contain in Core Java API, the latter requirement(platform-specific SWT native libraries) might be difficult for Sun to make decision to include platform-specific things in its Core Java API...


What is wrong in shipping platform specific code with JDK?
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Pradeep Bhat:


What is wrong in shipping platform specific code with JDK?


Does it have to ship with all possible platform-specific(mainly Windows, Linux, Mac OS and blah blah blah)... What if the user needs to run on the platform that is not shipped with JDK? Write Once, Run anywhere but not on that certain platform?

Pradeep, we got a great discussion again... Let's rock!!!
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

What if the user needs to run on the platform that is not shipped with JDK?


Why should the user do that? I dont have much knowledge of SWT, so I could be wrong here.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

SWT is the software component that delivers native widget functionality for the Eclipse platform in an operating system independent manner. It is analogous to AWT/Swing in Java with a difference - SWT uses a rich set of native widgets. Even in an ideal situation, industrial strength cross platform widget libraries are very difficult to write and maintain.


You can read more here
http://www.eclipse.org/articles/Article-SWT-Design-1/SWT-Design-1.html
[ July 06, 2004: Message edited by: Pradeep Bhat ]
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Pradeep Bhat:


Why should the user do that? I dont have much knowledge of SWT, so I could be wrong here.


Because there should be SWT native libraries that is platform-specific...
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by Ko Ko Naing:


Because there should be SWT native libraries that is platform-specific...


Yes. JDK for windows contains windows native code , JDK for Linux contains linux native code ? But our java classes will work on all these platforms.
[ July 07, 2004: Message edited by: Pradeep Bhat ]
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
Swing is very much not dead. I agree with Rob, I see a shift back towards rich clients. Thin clients are all well and good but their functionality is limited, respond slowly and in my experience are a nightmare to write & maintain.
I presume that SWT cannot be used in applets, so this another are where Swing is prevalent.

How much quicker is SWT than Swing ? I know it uses native widgets, but then so does AWT, and Swing is (in general) faster than AWT. Are there any performance studies out there ?

D.
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

I think after JDNC and JDIC projects , desktop application programming using java will be easier and great.
Steve Gebert
Greenhorn

Joined: May 07, 2004
Posts: 17
Sorry to just jump into this discussion but I wanted to add a point and a question. A point here is that some apps just require that they be on the desktop. Many many programmers work for agencies or businesses that are on one platform, Windows, and are not developing for the consumer market. I have to write programs that are used in our labs etc. They need to read ascii or excel files and parse them for upload into our oracle database. Web programming is fine, fun and in a lot of cases, appropriate - but not in all cases!

My question is, as a newbie to Java (I'm a .net retread) I have used the Swing components and have not heard of JFrame or SWT. What are the drawbacks to using these classes other than the platform issues? We are using JDeveloper and I would like to user richer components if possible. Thanks
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I presume that SWT cannot be used in applets, so this another are where Swing is prevalent.

But SWT can be use with Java WebStart.
Aaron Roberts
Ranch Hand

Joined: Sep 10, 2002
Posts: 174
Ahhhhhh!!! Whats all this crazy talk about Swing being dead? SWT being the new standard?

What type of apps are people writing that are so gui intensive? Word processors? Hex editors? File managers/browsers?

Swing is great for lots of stuff. If you don't like its looks, you can always use a different theme or create your own. As far as performance goes, I've never seen any type of benchmarks showing where the strengths and weaknesses are.

People tend to say they need a more media rich UI, but what do they really mean? More icons and images all over the place? Drag and drop abilities? How does Swing vs other toolkits fail and others succeed?

I can't imagine why someone wouldn't start with Swing and then branch off once they really understand the ins and outs of it. The only bone of contention I have with SWT is that I have no desire to learn another api. I've spent enough time learning Swing, that I would be making negative progress, just to get to the point I am now in Swing land.

My few thoughts.

Regards,
Aaron R>
Bhaumik Parekh
Greenhorn

Joined: Mar 30, 2003
Posts: 1
You can develop SWT usig any IDE. Only you need is required classes and knowledge

But now a days Swing is dying and if you do want to learn new technology then you should not go for swing.
Rob Warner
author
Ranch Hand

Joined: Apr 22, 2004
Posts: 50
I think someone wouldn't necessarily "start with Swing" because of Swing's philosophy: forget the native widgets, we'll just draw everything ourselves. This necessarily leads to widgets that don't blend seamlessly with the desktop.

For those that don't want to learn the SWT API, but yet take advantage of the native-widget benefits, look at The SwingWT Project.
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Steve Gebert:
I have used the Swing components and have not heard of JFrame or SWT.


Mmm... I am pretty sure that JFrame is one of Swing Components... I'm not so sure what you mean that you've not heard of JFrame, but you have used Swing components... JFrame is kinda a must in Swing components. JFrame even came before SWT...
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Rob Warner:
For those that don't want to learn the SWT API, but yet take advantage of the native-widget benefits, look at The SwingWT Project.


Mmm... SwingWT is still at the beta stage... It's kinda filling a gap in-between SWT and Swing UIs... Interesting though...

Thanks for the link, Mr.Rob...
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

I presume that SWT cannot be used in applets, so this another are where Swing is prevalent.


I dont know how many web sites use applet now a days. Some years back there were many but they seem to have disappeared. I see it only in stock tickers and news feeds at some sites.

Swing is (in general) faster than AWT

Is it? I am not sure about this. I always felt that AWT is faster than swing.
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Finally I got the example in chapter-3 run by my JBuilder X already!!!

My first "Hello World" with SWT and it's amazing... The frame Icon at the top-left is a Windows Icon... Really really like native application...

I just set the classpath to the SWT.jar that I downloaded and set the DLL library to swt-win32-2136.dll... Then I can run it successfully without spending that much effords...
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
does SWT run on MAC ?
Rob Warner
author
Ranch Hand

Joined: Apr 22, 2004
Posts: 50
Yes, it runs on a Mac. It supports:

  • Windows 98/ME/2000/XP
  • Windows CE
  • Linux (x86/Motif)
  • Linux (x86/GTK 2)
  • Linux (AMD 64/GTK 2)
  • Solaris 8 (SPARC/Motif)
  • QNX (x86/Photon)
  • AIX (PPC/Motif)
  • HP-UX (HP9000/Motif)
  • Mac OSX (Mac/Carbon)


  • (Taken from the Eclipse download page)
    Alvin chew
    Ranch Hand

    Joined: Jan 08, 2004
    Posts: 834
    I just set the classpath to the SWT.jar that I downloaded and set the DLL library to swt-win32-2136.dll... Then I can run it successfully without spending that much effords...


    ko ko Naing, can you please specify the step on "set the DLL library" ?
    Gregg Bolinger
    GenRocket Founder
    Ranch Hand

    Joined: Jul 11, 2001
    Posts: 15299
        
        6

    Originally posted by Ko Ko Naing:
    The frame Icon at the top-left is a Windows Icon... Really really like native application...


    And this is important why? Don't most applications use their own Icon anyway? Who cares about the default. I'm not trying to say anything against SWT here. I'm just trying to suggest a reminder that something like that is trivial and should not be considered a "feature" or deciding factor of using any library.
    Ko Ko Naing
    Ranch Hand

    Joined: Jun 08, 2002
    Posts: 3178
    Originally posted by Alvin chew:


    ko ko Naing, can you please specify the step on "set the DLL library" ?


    Put this, when you run the application...
    -Djava.library.path=<DirctoryContainingDLL>


    Otherwise, you won't be able to run your application... Hope this helps...
    Ko Ko Naing
    Ranch Hand

    Joined: Jun 08, 2002
    Posts: 3178
    Originally posted by Gregg Bolinger:
    And this is important why? Don't most applications use their own Icon anyway? Who cares about the default.


    Mmm... It's not important indeed... I just wanted to mention what I got from running the sample application from the book...

    You are absolutely correct that most applications use their own icon... All of the projects that I passed, which used Swing, have their own icon, related to the name of the application...

    I just wanted to share what I've got like a child... Yeah! See! I can eat vegetables...
    Hussein Baghdadi
    clojure forum advocate
    Bartender

    Joined: Nov 08, 2003
    Posts: 3479

    talking about SWT, I have downloaded swt-win32-2135.zip to try it.
    I have created a swing application like (JButton, JLabel ....)
    to see the diffs.
    to run the application, I wrote :
    java -cp .;%CLASSPATH%;swt.jar -Djava.library.path=lib MainWindow
    (lib contains swt-win32-2135.dll file)
    but the application still use swing laf !
    I am sure I have made something stupid, but I don't know what it
    is, can you help me ?
    JiaYun Jia
    Greenhorn

    Joined: Jun 28, 2004
    Posts: 7
    Originally posted by John Todd:
    talking about SWT, I have downloaded swt-win32-2135.zip to try it.
    I have created a swing application like (JButton, JLabel ....)
    to see the diffs.
    but the application still use swing laf !
    I am sure I have made something stupid, but I don't know what it
    is, can you help me ?


    SWT is not a laf. It has its own widgets. You must use classes from SWT not Swing.

    There's some SWT examples:

    http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/dev.html#snippets
    Gregg Bolinger
    GenRocket Founder
    Ranch Hand

    Joined: Jul 11, 2001
    Posts: 15299
        
        6

    Originally posted by John Todd:
    talking about SWT, I have downloaded swt-win32-2135.zip to try it.
    I have created a swing application like (JButton, JLabel ....)
    to see the diffs.
    to run the application, I wrote :
    java -cp .;%CLASSPATH%;swt.jar -Djava.library.path=lib MainWindow
    (lib contains swt-win32-2135.dll file)
    but the application still use swing laf !
    I am sure I have made something stupid, but I don't know what it
    is, can you help me ?


    Umm, if you build a Swing application, you have a Swing application.

    To use SWT you need to import it's classes (org.eclipse.swt.widgets.*) and use Button, Label, et al instead of the Swing libraries.
    Jorge Phillips
    Ranch Hand

    Joined: Jun 03, 2001
    Posts: 43
    Originally posted by Rob Warner:
    ...snip... As an SWT kind of guy, I now find myself in the curious position of defending Swing, but Swing is far from dead IMHO. ...snip...


    Rob, in one of our projects we debated whether to use SWT or Swing. We ended up using a combination of SWT/JFace and JWS to build a native-look client in a distributed system. It was the right choice for our requirement set. Yet, your comment above made me ponder on what might be so good about Swing compared to SWT/JFace beyond the uniform look-and-feel across platforms.

    Can you comment on what in Swing is so superior to SWT/JFace that you think will maintain Swing around? Or viceversa, what is inferior in SWT/JFace to the way it is handled in Swing?

    Thanks.
    Rob Warner
    author
    Ranch Hand

    Joined: Apr 22, 2004
    Posts: 50
    My comment dealt more with the traction that Swing has. Many developers know Swing, and feel no compulsion to switch. Sun is behind Swing. These reasons alone, I believe, will keep Swing around.

    As far as Swing advantages, I see a couple:

    1) Swing is written and maintained as a general purpose widget kit; SWT is written and maintained as a widget kit for building Eclipse. SWT is still terrific for building general purpose applications, much of its development depends on Eclipse needs (i.e. "That isn't a priority, as Eclipse doesn't need that").

    2) Third party widgets. Swing has been more visible, for a longer period of time, so third parties have developed powerful widgets for it. You're not seeing do-all Grid controls for SWT yet.

    The two sort of dovetail together; if #2 happens for SWT, it addresses #1. It will be interesting to see how it all plays out.
    Ko Ko Naing
    Ranch Hand

    Joined: Jun 08, 2002
    Posts: 3178
    Originally posted by Rob Warner:
    Sun is behind Swing. These reasons alone, I believe, will keep Swing around.


    Mmm... Then IBM should come up and stay behind SWT... Then I guess people will definitely switch to SWT...
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: SWT on any other IDE?