In 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.
Here, you will learn simply the procedure of creation a command button on the Java Awt Frame. There is a program for the best illustration the topic has been given ahead.
Description of Program
The following program has used simply the Button class for creating a command button on the frame object.
FlowLayout(): This is the constructor of FlowLayout class. This class is used for arranging the component from left to right. Here this is used for creating the object of the class to set the layout by passing the created object from the setLayout() method of the Frame class.
Here is the code of this program:
Output this program:
Liked it! Share this Tutorial