GUI (Graphical User Interface)

An applet is the software components or a small application which can run the program via JAVA programming Language.

Applets are on either desktop or on the web pages too.
The applets are mostly used for the GUI end user clients. The Applets are in GUI form.

Basically GUI is being used by the help of the JFrame which is located at the javax.swing

JFrame is the first platform for the deployment of the GUI applications. The Container classes are used to add the components at JFrame.

Some essential classes for the developing GUI app are:

  • JFrame
  • JPanel
  • JLabel
  • JButton
  • JTextField
  • and other classes ..

First of all if we are going to develop a small GUI program which can display the only the text;

[source language=’java’]
//import directives
import javax.swing.*;

public class Text1 extends JFrame{

public Text1() {
//FOR LABEL
JLabel label = new JLabel(“Hello JAVA !!!”);

//ADDING CONTAINERS TO COMPONENTS
this.getContentPane().add(label);
this.setSize(200,200);
this.setVisible(true);

}

public static void main (String[] args) {
// invoking constructor
new Text1();
}

}
[/source]

JFrame structure

JFrame structure

Now according to the above figure it represents a clear view of the our program in diagramatical form.

Leave a Reply