Jumat, 13 Desember 2013

JFC, Toolkit and Software Tiers used in GUI Programming: Introduction to JAVA

In JAVA, GUI features are supported via JFC. JFC is short for Java Foundation Classes, which encompass a group of features for building graphical user interfaces (GUI's) and adding rich graphics functionally and interactivity to Java applications. One major feature of JFC is Swing API, which includes everything from buttons to split panes to tables and every other functionally to create a GUI application.

Our later articles will describe, how to build GUI programs using Swing API’s features. The GUI programs that will create in Java will contain three tiers of software.
  • Graphical components make up the GUI such as a button or text box or a menu etc. Each graphical components has certain Properties. A property is a characteristic of an object such as its size, colour, title etc. You’ll learn about basics graphical components that Java’s Swing API offers, later in the articles.
  • Events Listeners that get notified about the events and respond to them.
  • The graphical Event Handler that do the work for the user in case the event occurs.
The graphical components are those like the one listed above. You can use them as they are, or extend them into your own classes. Event listeners are registered with GUI objects. In case of occurrence of an event, the objects notifies its event listeners them invokes event-handler method then executes the Java code written in it.

Java GUI toolkit

You know that a GUI in Java is created with at least three kinds of objects: components, events and listeners. A components is an object that defines a screen elements such as a push button, text field, scroll bar, menu, etc. the components that you can use for creating GUI in Java are available through Swing API.
A component is an object that defines a screen element such as a push button, text field, scroll bar, menu etc.

Types of Graphical Components

The graphical controls that you put in GUI applications are broadly of two types: the Container control and the Child control.

The container is control that can hold other control within it e.g. a Panel (there can be multiple controls inside a Panel) or Panes or simply frame (you can put so many controls on it). Control inside a container are known as a child controls. The child controls can exist completely inside their containers. That means you can’t move them outside their container and if try to drag them beyond and the boundary of their container, part of the control gets hidden. When you delete a container control, all its child controls automatically get deleted.

Do you know that Java GUI programming demands that all swing components s must contained in a container? A GUI application must contain a top-level container that can hold other controls in it.
A control is also known as a widget (short for window gadget). You can think of widget/ control as an element of a GUI that can be seen and that display an information and with user, e.g., a window, text field, frame etc. are widgets.
Graphical Controls of Swing

Tidak ada komentar:

Posting Komentar