Thursday 5 January 2017

Practical 2:Draw ten red circle in a vertical column in the center of the applet


Code:


import java.applet.Applet;

import java.awt.Color;
import java.awt.Graphics;



/**

 *
 * @author Queue
 */

/*

<applet code="practical2" width="500" height="400">
</applet>
*/
public class Practical2 extends Applet{
    public void init()
    {
        super.init();
        setSize(350,350);
    }
    public void paint(Graphics s)
    {
        for(int i=0;i<10;i++)
        {
       s.setColor(Color.red);
       s.fillOval(100, i*50, 50, 50);
    }
        
    }
    

}



Output:



Thanks 

Happy Coding ;)





2 comments: