Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build Java UI to run on all platforms

I am really confused over what to use. Options I see are awt, Swing and swt.

My question is which should be best for Desktop Java app on all platforms( Mac,Windows and Linux )with minimum platform dependent code ?

like image 642
YoK Avatar asked Jul 23 '26 15:07

YoK


1 Answers

AWT is obsolete, though some of its classes and design form the underpinnings of the Swing API.

Here is my take on the differentiators between creating applications in Swing and SWT:

Swing

  • + Forms part of the standard Java-SE platform, so fewer distribution headaches
  • + You can create a consistent look and feel across platforms
  • + Controls are lightweight, so creating your own is relatively easy
  • - If you need Swing applications to look like native applications, there may be a lot of work in it; Swing can be styled with a platform look'n'feel, but the results aren't always close enough for everyone's satisfaction

SWT

  • + Easy to create simple applications which use native widgets
  • - Manual resource management
  • - You need to distribute platform-specific libraries
  • - You face the lowest-common-denominator problem - not all widgets are available on all platforms, so some will be custom to SWT anyway

Although I've put a lot more minuses against SWT, I wouldn't discount it. Which technology you pick will depend on your project requirements. Picking the library is only the beginning when it comes to UI development.

Swing is the easy, low-maintenance option and I'd agree with the other posters that this is probably the best fit for what you want.

like image 172
McDowell Avatar answered Jul 26 '26 08:07

McDowell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!