Tham khảo sách 'java™ how to program ( deitel - deitel) - phần 22', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 27 g. setColor 28 g. drawRect 185 35 80 80 29 g. setColor 30 g. drawArc 185 35 80 80 0 -270 31 32 start at 0 and sweep 360 degrees 33 g. fillArc 15 120 80 40 0 360 34 35 start at 270 and sweep -90 degrees 36 g. fillArc 100 120 80 40 270 -90 37 38 start at 0 and sweep -270 degrees 39 g. fillArc 185 120 80 40 0 - 270 40 end method paintComponent 41 end class ArcsJPanel Figure . Creating JFrame to display arcs. This item is displayed on pages 618 - 619 in the print version 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Fig. Drawing arcs. import public class DrawArcs execute application public static void main String args create frame for ArcsJPanel JFrame frame new JFrame Drawing Arcs ON CLOSE ArcsJPanel arcsJPanel new ArcsJPanel create ArcsJPanel arcsJPanel add arcsJPanel to frame 300 210 set frame size true display frame end main end class DrawArcs PREV NEXT PREV NEXT Page 618 . Drawing Polygons and Polylines Polygons are closed multisided shapes composed of straight line segments. Polylines are sequences of connected points. Figure discusses methods for drawing polygons and polylines. Note that some methods require a Polygon object package . Class Polygon s constructors are also described in Fig. . The application of Fig. . draws polygons and polylines. Figure . Graphics methods for polygons and class Polygon methods. This item is displayed on pages 619 - 620 in the print version Method Description Graphics methods for drawing polygons public void drawPolygon int xPoints int yPoints int points Draws a polygon. The x-coordinate of each point is specified in the xPoints array and the y-coordinate of each point in the yPoints array. The last argument specifies the number of points. This method draws a closed polygon. If the last point is different from the first the polygon is