In this section you will learn about the AWT package of the Java. Many running examples are provided that will help you master AWT package. Example provided are supported with tested code.
AWT Components
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:
Describe different types of event to provide by the AWT Components in
java
Event Adapters
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",
"Aurevoir".
Adapters Example
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.
GUI-based Applications
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
application.
Menus
We can also develop an application with a Menu.
As a name indicates a Menu consists of Menu objects.
Pop-up Menus
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.
BasicStroke class. This
object is passed to the setStroke() method.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.
|
Recommend the tutorial |










Ask Questions? Discuss: Java AWT Package Example View All Comments
Post your Comment