- Graphical User Interfaces
A class library is provided by the Java programming language
which is known as Abstract Window Toolkit (AWT).
- What is AWT in java
In this section, you will learn about the java.awt.*;
package available with JDK. AWT stands for Abstract Windowing Toolkit.
- Describe the AWT Components
In this section you will learn about the different components available
in the Java AWT package for developing user interface for your program.
The class component is extended by all the AWT components. More
of the codes can be put to this class to design lot of AWT components. Following
are the AWT components:
The common methods of AWT components are as follow:
Common Component Methods
- As discussed earlier a container is a component that
can be nested. The most widely used Panel is the Class Panel which can be extended
further to partition GUIs.
- There are many types of events that are generated by your AWT Application.
These events are used to make the application more effective and efficient.
Generally, there are twelve types of event are used in Java AWT.
Describe different types of event to provide by the AWT Components in
In this section, you will learn how to handle events in Java awt. Events are the integral part of the java platform.
There are some event listeners that have multiple
methods to implement. That is some of the listener interfaces contain more than one method.
Button Pressing Example
In the program code given below, the Frame contains
three buttons named - "Bonjour", "Good Day",
In the following program code, the adapter class has been used.
This class has been used as an anonymous inner class to draw a rectangle within an applet.
In this section you will learn about how to create a window for your
application. You need to define a subclass of Frame to create a window for your
We can also develop an application with a Menu.
As a name indicates a Menu consists of Menu objects.
- Menu Shortcuts
The MenuItem class also provides
a feature of menu shortcuts and speed keys.
A PopupMenu is similar to a Menu as it
contains MenuItem objects. The Pop-up Menu can be popped over any
component while generating the appropriate mouse event rather than letting it
appear at the top of a Frame.
- Creating a FrameThis program shows you how to create a frame in java AWT package. The
frame in java works like the main window where your components (controls)
are added to develop a application. In the Java AWT, top-level windows are
represented by the Frame class.
- Setting the Icon for a FrameHere, you will learn how to set the icon of the frame. This program is
the detailed illustration to set the icon to the frame.
- Setting the
close button operation for the frame
In this section, you will learn how to implement the close button of any
frame or window in java application. By default the close button of the
frame is not in working state.
- Making a Frame Non-ResizableThis program illustrates you how to make a frame non resizable. It means
that the disabling the maximize button of the frame.
- Removing the Title Bar of a FrameHere, you will learn how to display the frame or window without title
bar in java. This type of the frame is mostly used to show the splash screen
at starting of the application.
- Creating a ContainerThis program illustrates you how to create a container. Container
contains several control or tools for develop your application. All the
controls used in your application are the container for one another.
- Changing the Cursor
Here, you will learn how to change the mouse cursor in java. Changing the
cursor means showing cursor in many different shapes for the different
- Draw Image in FrameIn this section, you will learn how to display image on the frame. This
program shows you how to display image in your application.
- Handling Focus ChangesIn this section, you will learn about handling the focus changes in
java. This section shows you how the event be handled according to the
focuses and to find out whether the component got the focus or lost the
- Handling Mouse ClicksIn this section, you will learn about handling the mouse click event in
the awt application.
- Handling Action EventsIn this section, you will learn how to handle events in java awt. Here,
this is done through the java.awt.*; package
of java. Events are the integral part of the java platform.
- Handling Key PressesIn this section, you will learn about the handling key press event in
java. Key Press is the event is generated when you press any key to the
- Item EventsIn this section, you will learn about handling item events in java. This
demonstrates that the event generated when you select an item from the group
of the items.
- How to use
KeyListener In this section, you will learn how to handle different key events
on the Java Awt component by using the event handling in Java. When the
given program is executed then you will see the several key events these are
applied on the component like the key pressed, key release and so on.
- Simple Form in Java
This is a simple program of java awt package which constructs a look like a form by using various java component. In this section, you will learn how to create it. This is done by using java gui programming using Classes or APIs of java awt package.
- Hiding Frame in Java
This section illustrates you how to hide the Java Awt frame. Here, you have seen in the given following example that provides you the complete code of the program.
to Create Button on FrameIn this section, you will learn how to create Button on frame
the topic of Java AWT package. In the section, from the generated output of
the following program, complete window or frame is created in the ButtonText
class that is the main class where the main() method lies.
This part of the topic will show a simple command button labeled with the
text "Submit" when the program will be executed.
to create CheckBox On frameThis is very simple java program. In this section, you will learn
how to create CheckBox on the frame. In the Java AWT, top-level windows are
represented by the CheckBox class. This program provides you complete
illustration with the full description. If you are fresher in java awt
programming then you can learn in very efficient manner.
Option (Combo) In JavaIn this section, you will learn how to create Drop-Down List by
using Java AWT package.
Drawing In JavaIn this section, you will learn how to create arcs diagram in java awt
package. The Java program uses Arcs2D class, arcs2D is the abstract
superclass for all objects that store a 2D arc defined by a bounding
rectangle, start angle, angular extent and a closure type.
Example In JavaIn this section, you will learn how to create BorderLayout in java awt
package. The Border Layout is arranging and resizing components to set in
five position which is used in this program.
Diagram In Java
In this section, you will learn how to create Cubic diagram. The
Java2D API provides you several classes that defines common Geometry
object as a coordinate component. The Java Drawing program depends on the
Java2D API class, and this class is support by the "java.awt.geom"
to Create Circle In JavaThis is a simple program of java awt. In this section, you will learn
how to create Circle Diagram. The java circle is the most fundamental
abstractions in a Java 2D in the supported java.awt.shape package.
to Create CurveDraw In Java In this section, you will learn how to create CurveDraw in java.awt
package. This class, supported by the java.awt.geom package, enables
you to create a quadratic or cubic segment. Here, you will see in the
following example that provide you complete code of the program.
to Create LineDraw In JavaThis is a simple java program . In this section, you will learn how to
create Line Drawing. This program implements a line Drawing component.
A java program explains the stroke line i.e. how to make thick and thin
line. For this we have used
BasicStroke class. This
object is passed to the setStroke() method.
In JavaIn this section, you will learn how to create Radio Button on the frame.
The java AWT , top-level window, are represent by the CheckBoxGroup. A
java program provides you CheckboxGroup. In this program, you will see how
to create and show the Checkboxgroup component on the frame.
Image In JavaIn this section, you will learn how to create rectangle image. This
program used the Graphics2D class which extends the Graphic class and
control all geometry or coordinate transformation and color
management, text layout. The Java programming in java 2D API
provides several classes.
Frame In JavaIn this section, you will learn how to create TextArea on the frame.
This program uses the TextArea class of java.awt package. Here, we are
going to create TextArea object. TextArea object is a multiline
region. It displays text only. You can read and edit the text only.
- Image DemoThis section simply display the image demo that means multiple images
and its name are based on the frame to a particular location. For displaying
images demo first of all you will need multiple images that have to be
displayed on the frame.
- Image SizeThis Java awt (Abstract Windowing Toolkit) tutorial describes about the
image size. This is an actual representation of object. Simply, it helps us
to feel associated with an object on the frame.
- Paint Icon
This section provides you to paint an image on the frame. Paint means draw
an image and set its on the frame to the specified location according to its
x coordinate and y coordinate.
This Java tutorial teaches you about adding the rendering
hints to a graphics on the frame. The rendering hints uses the Graphics2D
and creates the following image.
In this example we are creating an animated line. The color of line is
Lets learn how to create beep using java.
Open The Default Editor to Edit the File
This section, you will see the method of opening the file in the default
editor to edit and save the file. Here an example has been provided with the
complete Java code for illustrating all the things that helps to open the file
in the default editor to edit the file.