APPLET
import required
classes and
packages
filename
Your variable
(that can be any
letter/s)
DRAW STRING
String to be Position of
Your variable displayed Strings
y-axis
Code for X-axis
displaying
Strings
SETTING FONT Font.BOLD
Font.PlAIN
Font.ITALIC
variable Font Font Style Font Size
Declare
variable
A Color object can be created with this three constructors:
Color.red
Color(R,G,B)
Color(float red, float green, float blue)
For example:
Chosen color Chosen color
Chosen color
Take note, you need to declare
first the color before the output
An oval can be drawn using the method drawOval() as follows:
variable.drawOval( int x, int y, int width, int height )
y-axis
height
x-axis width
width
height
A rectangle can be drawn using the method drawRect() as:
variable.drawRect( int x, int y, int width, int height )
y-axis
height
x-axis width
width
height
A line linking two points can be drawn using the method drawLine() as follows:
variable.drawLine( int x1, int y1, int x2, int y2 )
2nd point
1stpoint
2nd point y-axis 2nd x and
1stpoint y-axis y axis
x-axis
x-axis
1st x and
y axis
POLYGON
Open the image on paint
Enable the ruler and guideline shown in view tab
Zoom in (max) the photo and mark the After marking all the necessary area, gather and
corners that you have to trace / draw list their x and y axis by simply placing the cursor on
the marked pixel and on the lower left area of the
paint you’ll see their corresponding x and y
CURSOR
*Zoom in to see the marked areas
X-AXIS
Y-AXIS
After listing all the x and y axis of the marked areas, you can now use the method
fillPolygon() and/or drawPolygon () as follows:
variable. fillPolygon(xPoints, yPoints, x or y avariable.length);
variable.drawPolygon(xPoints, yPoints, x or y avariable.length);
Variables Total count of numbers X-AXIS Y-AXIS
fillPolygon
drawPolygon
Y-AXIS
Total count of numbers
Take note:
X-AXIS the count of numbers on the x and y axis must be equal.
If the X points is 13 then y points should be 13
drawPolygon () method VS drawPolyline() method
Starting point End point
End point
Starting point
On drawPolyline you have to encode again the starting point at
the end to close the drawing or to meet the starting and end
point
Unlike on drawPolygon, even you don't input the starting
points at the end, the drawing will automatically close or meet
the starting point.
End point
Starting point
Starting point
End point
BACKGROUND MUSIC
Filename (music)
variable
Declare
variable
Html file
On the HTML file, you can
customize the size of your
applet based on what size
you prefer.