Chapter 5.
Java Applets & Graphics Programming
4 Marks
1. State syntax and explain it with parameters for :
a) drawRect ( ) ii) drawOval ( )
2. Design an Applet program which displays a rectangle filled with red color and
message as “Hello Third year Students” in blue color.
3. Write a program to design an applet to display three circles filled with three
different colors on screen.
4. Explain all attributes available in < applet > tag.
5. Describe following states of applet life cycle :
a) Initialization state b) Running state. c) Display state.
6. Differentiate applet and application with any four points.
7. Describe applet life cycle with suitable diagram.
8. Describe following attributes of <applet> tag :
1) codebase 2) code 3) width 4) alt
6 Marks
1. Write method to set font of a text and describe its parameters.
2. Explain <applet> tag with its major attributes only. State purpose of
getAvailableFontFamilyName ( ) method of graphics environment class.
3. Differentiate between applet and application and also write a simple applet
which display message ‘Welcome to Java’.
4. Explain <PARAM> Tag of applet with suitable example.
5. Write the syntax and example for each of following graphics methods :
1) drawPolygon ( ) 2) drawRect ( ) 3) drawOval ( ) 4) fillOval ( )
6. Write syntax and example of following Graphics class methods :
1) drawOval ( ) 2) drawPolygon ( ) 3) drawArc()
8 Marks
1. Write a simple applet program which display three concentric circle.
2. Write syntax and example of following Graphics class methods :
a. drawOval( ) b. drawPolygon( ) c. drawArc( ) d. drawRect( )
3. How can parameters be passed to an applet? Write an applet to accept user name
in the form of parameter and print ‘Hello < username >’.
4. Write syntax and example of
a. drawString ( ) b. drawRect ( ) c. drawOval ( ) d. drawArc ( )
5. Design an applet which displays three circles one below the other and fill them
red, green and yellow color respectively.
6. Write a program to design an applet which accepts 2 numbers as parameters using
<PARAM> tag and display addition of squares of those numbers.