Saturday, 28 March 2015

How To Draw Arc In Applet

We can also draw arc in  Applet class it can be draw with drawArc() & fillArc() shown below:
void  drawArc(int top,int left,int width,int height,int startAngle,int sweepAngle)

void fillArc(int top,int left,int width,int start Angle,int sweepAngle)
The arc is drawn counterclockwise if sweep angle is positive if it is negativearc will drawn clockwise.

HTML CODING:

<html>  
<body>  
<applet code="arc" width="300" height="300">  
</applet>  
</body>  
</html>

JAVA CODING:

import java.applet.*;  
import java.awt.*;  
public class arc extends Applet
{  
  
public void paint(Graphics g)
{  
g.drawArc(10,40,70,70,0,75);
g.fillArc(100,40,70,70,0,75);
g.fillArc(100,100,70,90,0,270);  
g.drawArc(200,80,80,80,0,180);
}  
  
}  


OUTPUT:



No comments:

Post a Comment