Java Graphical User Interface: An introduction

by FossilizedCarlos on February 19, 2012

The Java language was born out of a need for a single program to be able to be compiled, and ran on multiple operating systems. The Java language was launched in 1995 by Sun Microsystems, and derived much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. The language would compile into byte code that could be run in the Java Virtual Machine (JVM), regardless of your operating system. Java still faced a problem though, how do you write a program where the windowing system will match that of the operating system running it?

This is where the Abstract Windows Toolkit (AWT) stepped in, and became Java’s original platform-independent windowing, graphics, and user-interface widget toolkit. The AWT is now part of the Java Foundation Classes (JFC) — the standard API for providing a Java graphical user interface (GUI) for a program. AWT provided Java with the look and feel of the operating system in which it was running. The Java 2 (J2SE 1.2) saw the addition of the Swing toolkit, which largely superseded the AWT’s widgets. In addition to providing a richer set of UI widgets, Swing draws its own widgets instead of relying on the operating system’s high-level user interface module. Swing provides the option of using either a system “look and feel” which uses the native platform’s look and feel, or a cross-platform look and feel (the “Java Look and Feel”) that looks the same on all platforms. However, Swing relies on AWT for its interface to the native windowing-system.

This series will encompass most of the classes that can be used in the creation of a Java Graphical User Interface, and the code base will grow to show the additional features added. The series will begin with the following classes:

  • JFrame
  • JPanel
  • Layout Managers
    • FlowLayout
    • GridLayout
    • BorderLayout
    • GridBagLayout
  • JButton
  • JSlider
  • ActionListerner
  • MouseListener
  • ChangeListener

…and more will be added as the series grows

Sources:
Java [Wikipedia]
Abstract Window Toolkit [Wikipedia]
Java Swing [Wikipedia]

Share This Content
Stay Updated!

Previous post: