Chirantan (java)

345 views

Published on

java

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
345
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Chirantan (java)

  1. 1. Graphics Programing 1. The Graphics class 2. The Color class 3. The Font class 4. The FontMetrics class 5. The Dimension class
  2. 2. 1. Method of Graphics class A) drawLine(): -:Draw line method used to draw a line. -:This method draw line joninig the points (x1,y1) and (x2,y2). Syn: void drawLine(int x1,int y1,int x,int y2); Ex: g.drawLine(20,30,80,100); O/P-:
  3. 3. B) drawString(): -:The msg is displayed at the spcified location spcified by the x and y co-ordinates. Syn-: void drawString(String msg,int x,int y); EX-: g.drawString(“JSN”,10,40); O/P-: JSN
  4. 4. C) drawRect(): -:This method draws a rectangle from the upper-left corner at the point (x,y)of the width and height specified by which and height. Syn-: void drawRect(int x,int y,int width,int height Ex-: g.drawRect(120,60,100,50); O/p-:
  5. 5. D) fillRect(): -: It draws and fill the rectangle with color. Syn-: void fillRect(int x,int y,int w,int h); EX-: g.fillRect(120,60,100,50); O/P-:
  6. 6. E) drawRoundRect(): -:This method are used to draw a Round Rectangle. Syn-: void drawRoundRect(int x,int y,int w,int h, int xdia,int ydia); EX-:g.drawRoundRect(120,60,100,50,100,50); O/P-:
  7. 7. F) fillRoundRect(): -:It draws and fill the roundrectangle with the color. Syn-: void fillRoundRect(int x,int y,int w,int h, int xdia,int ydia); EX-: g.drawRoundRect(120,60,100,50,100,50); O/P-:
  8. 8. G) drawOval(): -: This methods draws an oval.The oval is drawn within the bounding rectangle. Syn-: void drawOval(int x,int y,int width,int height); EX-:g.drawOval(120,180,100,50); O/P-:
  9. 9. H) fillOval(): -:It draws and fills the oval with Color. Syn-: void fillOval(int x,int y,int width,int height); EX-: g.fillOval(120,240,75,75); O/P-:
  10. 10. I) drawPolygon(): -:This method is used to draw a polygon of num of points angles. Syn-: void drawPolygon(int x[ ],int y[ ],int n); EX-:int x[ ]={170,220,220,120,120}; g.drawPolygon(x,y,5); int y[ ]={380,430,480,480,430}; O/P-:
  11. 11. J) fillPolygon(): -: It draws and fills the polygon with color. Syn-: void fillPolygon(int x[ ],int y[ ],int n); EX-:int x[ ]={170,220,220,120,120}; int y[ ]={380,430,480,480,430}; g.fillPolygon(x,y,5); O/P-:
  12. 12. Thank You Jay Swaminarayan

×