Working with graphics in java applet

Working with graphics in java applet:-  


(x,y)&(x1,y1) are starting coordinates. 
h-height                                
w-width                                 
1. drawOval(int x,int y,int h,int w);   
2. drawRect(int x,int y,int h,int w);   
3. fillOval(int x,int y,int h,int w);   
4. fillRect(int x,int y,int h,int w);   
5. drawLine(int x,int y,int x1,int y1); 
6. drawArc(int x,int y,int h,int w,int startangle,int endangle);

Oval :- to draw ellipse    
rect :- to draw a rectangle
line :- to draw a line     
Arc  :- to draw an arc     
For more description of circle click here...

Q.How to draw Circle ?                                     

Ans. 1. using drawOval                
     h=w;                             
    drawOval(int x,int y,int h,int w);
    2. using drawArc                  
     h=w;                             
     startangle=0;                    
     endangle=360;                    
    drawArc(int x,int y,int h,int w,int startangle,int endangle);
    

Q.How to Draw Square ?

Ans. Using drawRect                     
      h=w;                              
      drawRect(int x,int y,int h,int w);

for example and code Click here


Comments