50% found this document useful (2 votes)
721 views

Java Applet (Ice Cream)

This Java code defines a NERVIZA class that extends the Applet class. The paint method draws various shapes like polygons, ovals, arcs and lines to display a face-like image. Coordinates and colors are used to draw the yellow polygon outline of the face, green and red ovals for eyes, a blue oval for the mouth, and black lines connecting different points.

Uploaded by

Jasper ﭢ Cazin
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
50% found this document useful (2 votes)
721 views

Java Applet (Ice Cream)

This Java code defines a NERVIZA class that extends the Applet class. The paint method draws various shapes like polygons, ovals, arcs and lines to display a face-like image. Coordinates and colors are used to draw the yellow polygon outline of the face, green and red ovals for eyes, a blue oval for the mouth, and black lines connecting different points.

Uploaded by

Jasper ﭢ Cazin
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

import java.awt.

*;

import java.applet.*;

public class NERVIZA extends Applet

public void paint(Graphics g)

int x[] = {70,120,100,70};

int y[] = {110,110,160,110};

int npoints=4;

g.setColor(Color.yellow);

g.drawPolygon(x,y,npoints);

g.fillPolygon(x,y,npoints);

g.setColor(Color.black);

g.drawLine(70,110,105,153);//1

g.drawLine(80,110,108,140);//2

g.drawLine(100,110,100,160);//3

g.drawLine(90,110,112,132);//4

g.drawLine(110,110,120,120);//5

g.drawLine(90,110,80,120 );//1

g.drawLine(100,110,83,128);//2

g.drawLine(110,110,88,133);//3

g.drawLine(120,110,90,140 );//4

g.drawLine(115,126,95,145 );//5
g.drawLine(110,140,98,153);//6

g.drawLine(70,110,100,160 );//outline

g.drawLine(120,110,100,160 );//outline

g.setColor(Color.green);

g.drawOval(60,30,70,40);

g.fillOval(60,30,70,40);

g.setColor(Color.red);

g.drawOval(60,50,70,40);

g.fillOval(60,50,70,40);

g.setColor(Color.blue);

g.drawOval(60,70,70,50);

g.fillOval(60,70,70,50);

g.setColor(Color.black);

g.drawLine(60,140,80,120);

g.drawLine(120,120,140,140);

g.drawLine(100,160,80,190);

g.drawLine(100,160,120,190);

g.setColor(Color.black);

g.drawOval(80,80,10,10);

g.fillOval(80,80,10,10);

g.drawOval(100,80,10,10);

g.fillOval(100,80,10,10);

g.drawArc(85,88,20,14,180,180);

You might also like