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.
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:
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".
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 application.
We can also develop an application with a Menu. As a name indicates a Menu consists of Menu objects.
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.
BasicStrokeclass. 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.
Liked it! Share this Tutorial