Difference between revisions of "Graphics"

From MyWiki
Jump to: navigation, search
Line 11: Line 11:
 
drawPolygon(int x[ ], int y[ ], int n)<br>
 
drawPolygon(int x[ ], int y[ ], int n)<br>
 
Used to draw a polygon created by n line segments.  The command will close the polygon.  (x-coordinates go in one array with accompanying y-coordinates in the other)<br>
 
Used to draw a polygon created by n line segments.  The command will close the polygon.  (x-coordinates go in one array with accompanying y-coordinates in the other)<br>
 +
<br>
 +
g.drawString("Java is cool!", 40, 70);
 +
drawString(String str, int x, int y);

Revision as of 17:41, 17 November 2014

Java AWT
g.drawLine(35, 45, 75, 95);
g.drawRect(35, 45, 25, 35);
g.drawRoundRect(35,45,25,35,10,10);
g.drawOval(25, 35, 25, 35);
g.drawArc(35, 45, 75, 95, 0, 90);

int [ ] x = {20, 35, 50, 65, 80, 95};
int [ ] y = {60, 105, 105, 110, 95, 95};
g.drawPolygon(x, y, 6);
drawPolygon(int x[ ], int y[ ], int n)
Used to draw a polygon created by n line segments. The command will close the polygon. (x-coordinates go in one array with accompanying y-coordinates in the other)

g.drawString("Java is cool!", 40, 70); drawString(String str, int x, int y);