You are on page 1of 2

Question Bank: Practical no.

3 AJP (TYIF)
Title: Program based on Fonts and Colors

1. Create an event driven applet program which will change the background
color of applet when the mouse is entered in the applet or clicked inside the
applet.
2. Create a text field, and button on the applet. The text field will accept the
name of the color. After pressing the button the background color of applet
will get changed. If the color does not match, it will give error.
3. Accept a string and its position from text field and display it on specified
position on the applet with ‘Verdana’, Bold, Italic, 23.
4. Display a text area and three buttons on the applet named “Times”,
“Courier” and “Arial Narrow”. When we click on any of these buttons, the
string entered from text area will get displayed in respective font.
5. Display a text area and six buttons on the applet named “Red”, “Green”
“Pink”, “Magenta”, “Cyan”, and “Blue”. When we click on any of these
buttons, the string entered from text area will get displayed in respective
color with gray background, Times New Roman, 20, Underlined font and
Flow layout-left.
6. Create an applet to display the text field. When we enter the mouse over the
applet the string entered in the text field will get displayed in “Arial”, 25,
Plain font at position 50,150. And When we exit the mouse from the applet
the string entered in the text field will get displayed in “Arial Narrow”, 20,
Bold font at position 50,150.
7. Create an event driven applet program to display your name at the center
with Red background, RGB (200,145,230) foreground, Book Antigua, 19,
BOLD, ITALIC. When we enter mouse in applet, the displayed text will be
changed to RGB (100,20,190) background, RGB (200,120,250) foreground,
Book Antigua, 25, ITALIC, UNDERLINED. When we click mouse in applet, the
displayed text will be changed to Black background, Gray foreground,
Verdana, 22, Bold, ITALIC, UNDERLINED.
8. Create an event driven applet program to display your name at the center
with Light Red background, RGB (150,245,10) foreground, Arial, 20, BOLD,
ITALIC. When we press ‘F1’ key on applet, the displayed text will be changed
to RGB (10,220,90) background, RGB (30,220,150) foreground, Times, 35,
ITALIC, UNDERLINED. When we press ‘F2’ key in applet, the displayed text
will be changed to Gray background, Light Blue foreground, Arial Narrow,
25, Bold, ITALIC, UNDERLINED.
9. Display a text area on applet with font ‘Courier New’. When we press the
button present on applet the same text will get displayed in another text
area with ‘Times New Roman’ font. Set the foreground color as RGB
(120,230,200).
10. Create an event driven applet to display your name on it. When we click on
the applet display area, the color and font size of the text will get changed
each time differently. Use ‘Times New Roman’ as default font.
11. Display a text field and a button on the applet. When we enter the text in
the text field it will get displayed on applet at (100,200) with Courier New,
26, BOLD, ITALIC. After each click on the button, the size of the font will get
changed.

AJP Practical No. 3 -1-


12. Display a text field and a button on the applet. When we enter the text in
the text field and click on the button, the text field’s text will get displayed
on the applet with different fonts, font sizes, and font styles on different
positions.
13. Display name of your college on the applet with ‘Verdana’, 18, Bold, Red.
When you drag the mouse on the applet, font size of the text will get
incremented and the background color will get changed.
14. Create an applet to display the Indian flag on the applet. Display the text
‘Indian Flag’ below it with “Times New Roman”, 25, ITALIC.
15. Create a text field, and three buttons on the applet. The buttons are named
with ‘Arial Narrow”, “BOLD”, “ITALIC”. When we click on any of these
buttons, the text entered from text field will get displayed on the applet (10,
150) positions with respective font type. Use the background color as pink.
16. Create an event driven applet for handling mouse events. When you enter
your mouse in the applet, the background color of the applet will get
changed as you move the mouse on it. After exiting from the applet, the
background color will be applied as ‘White’. After clicking on the applet the
current color will be a stationary color of applet. This process will be
continued until mouse is exited and entered.
17. Display four different buttons and a text field on applet. Use insets positions
as (20, 20, 20, 20). Apply background color as ‘Light Red’. Use border layout
to set the text field at the center. The buttons are named with ‘Japan’,
‘India’, ‘Korea’ and ‘China’. When you click on any of these buttons, the text
present on it will get displayed in the text field with ‘Times’, ‘Courier’, ‘Arial’,
‘Verdana’ fonts respectively. Use any shade of red as the foreground color.
18. Display four different text boxes on the applet. First is to input the name of
font, second is to input foreground color, third to input background color and
fourth to input the text. After pressing the ‘Enter’ from the keyboard, the
inputted text will be displayed at (150, 250) positions with respective
combination of Colors and Font.
19. Display name of your college on the applet with ‘Lucida Bright’ font, 20,
UNDERLINED at 120, 200 positions. Set foreground color as Dark Green and
background color as Yellow. After pressing ‘F10’ key each time, the font of
the text will get increased. Use ‘escape’ key to exit from applet.
20. Display three concentric circles on the applet with different colors, excluding
standard colors provided by compiler. Display the string ‘Circle’ at the center
of circles with font ‘Tahoma’, 30, BOLD, UNDERLINED, ITALIC, GREEN. Use
any shade of blue as the background color.

AJP Practical No. 3 -2-