Addition2

@Override
public void paint(Graphics g) {
g.drawString("The Sum is " + sum, 40,40);

setBackground(Color.CYAN);

Dimension appletDims = this.getSize();
int myHeight = appletDims.height;
int myWidth = appletDims.width;

g.drawString("This applet is " + myHeight + " high and " + myWidth + " wide", 40,70);

g.setColor(Color.red);
g.drawLine(0,myHeight,myWidth,0);

int x = 100;
int y = 130;
int r = 50;

g.drawOval(x-r,y-r,100,100);
g.setColor(Color.yellow);
g.fillOval(x-r,y-r, 100, 100 );

x = 95;
y = 125;
r = 30;

g.setColor(Color.black);
g.drawOval(x-r,y-r,70,70);
g.setColor(Color.yellow);
g.fillOval(x-r,y-r,70,70 );

g.drawRect(63,95,73,40);
g.fillRect(63,95,73,40);

x = 105;
y = 135;
r = 30;

g.setColor(Color.black);
g.drawOval(x-r,y-r,10,10);
g.setColor(Color.black);
g.fillOval(x-r,y-r,10,10 );

x = 145;
y = 135;
r = 30;

g.setColor(Color.black);
g.drawOval(x-r,y-r,10,10);
g.setColor(Color.black);
g.fillOval(x-r,y-r,10,10 );

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>