Module-5 Sample Programs:
1. Write a java program to creates three push buttons showing three different colors as their label.
When a button is clicked, that particular color is set as background color in the frame.
2. Write a java awt program, which will create 3 text field and one button labelled as Subtract. The
program will take the input from the two text filed and upon pressing the Subtract button it will
display the result in the third text field.
3.
4. Write a java awt program, which will create 2 text field and one button labelled as Factorial. The
user will enter a number in the 1 st text field and upon pressing the button it will display the
Factorial of the number in the 2nd text field.
5. Write a java awt program, which will create 2 text field and one button labelled as Reverse. The
user will enter a number in the 1 st text field and upon pressing the button it will display the
reverse of the number in the 2nd text field.
6. Design an AWT GUI application (called AWT Counter). Each time the "Count" button is clicked,
the counter value should increase by 1 and each time the Reset button is clicked the counter
value should be reset to zero.
7. Create three color buttons (with caption “Red”, “Blue” and “Green”) and a text label. Initially the
text should be displayed in black color. When the user clicks on a particular color button the text
should be changed to that particular color as shown in the figure.
8. Write a AWT program, which creates 2 text field with two labels and one button labelled as
Count. The program will take the input from one text filed. When we click the button it will
count the number of digits of the given number and display the result in the second field. Label
one will be written as "Input number" and second label will show "Number of digits: ".