James Gosling: idealism, the Internet and Java, Pt I

Sunday 28 January 2018

Java desktop GUI.

Graphical user interface in short GUI makes computer users easy to understand and use the application software comfortably. Almost all modern programming languages allows application developers to develop GUIs.

Java has AWT/Swing as default API as part of Java Foundation classes in short JFC which are shipped with JDK. Hence these toolkits can be used directly in our applications with out adding external libraries like jars to our application's class path. But there are some other toolkits which found useful and industry endorsed in developing GUI.

    •      SWT 
    •      JFaces [Framework for SWT]
    •      Java FX
    •      Swing
    •      AWT

AWT:

Abstract window toolkit is available since java first version. AWT uses native operating system resources like Fonts, colors and components like table, tree, dialogues, windows etc.

Few notable points about AWT:
  • AWT is heavy weight. It uses OS resources
  • There are limited components in AWT precisely only components which are available in native OS. 
  • We can not have a new component according to our business logic need. ex: Tri state checkbox or treetable  
  • AWT behaves differently on different platforms
  • Hence it violates the java Platform independence rule
  • The program GUI developed with AWT looks differently on different OSs. Means on linux it renders linux graphics look and feel and on windows platform it renders windows graphics look and feel.   
  • Provides event model API which also used by Swing toolkit

Swing:

  • Swing was designed and developed keeping all cons in mind that are caused due to using AWT toolkit.
  • First of all "Swing is pure java hence it is platform independent." This statement made many good things possible:
Few notable points about Swing:
  •  Swing is light weight. It does not depend on native OS resources 
  •  Unlike AWT, it is extensible. New custom components can be developed according to program  requirement. 
   NOTE: See swingx library in it's official site.
  •  Swing has Pluggable look-and-feel support in short PLAF.
  •  Drag and Drop api, 2D api, internationalization are few among other included in Swing toolkit.
  •  Netbeans IDE itself is a good example for swing based application used allot now a days.
  •  Few GUI experts noticed that Swing is slow and not quite professional for commercial applications

SWT:

Standard Widget toolkit in short SWT is another toolkit for developing Java Desktop GUI based applications.
Compared to Swing it is faster and consistent in performance and Eclipse IDE itself is an example for SWT based applications.
Eclipse is industry endorsed IDE specifically for java based software development.
This is not shipped with JDK. Please see eclipse.org [official site] for more details.
And there are Integrated development environments in short IDE which provides Drag and Drop [DAD] palettes also known as GUI Builders for above toolkits for programmer's convenience.
Mostly used IDEs are:
It is advised to code manually to develop the GUI rather using GUI builders provided by different IDEs. And for beginners.  


No comments:

Post a Comment

Popular posts

Demonstration of Java NullPointerException

NullPointerException causes and reasons Since Java is object oriented programming language, every thing is considered to be an object. and t...