码迷,mamicode.com
首页 > 其他好文 > 详细

e587. Filling Basic Shapes

时间:2018-09-06 11:07:03      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:start   can   struct   ons   example   wing   methods   table   phi   

There are two ways to fill basic shapes like lines and rectangles. The first is to use specific drawing methods like Graphics.fillOval(). This example uses these methods. The second is to construct a shape and then use Graphics2D.fill() to fill the shape. See the java.awt.geom package for examples that create shapes.

    
g2d.fillArc(x, y, w, h, startAngle, arcAngle);
    g2d.fillOval(x, y, w, h);
    g2d.fillRect(x, y, w, h);
    g2d.fillRoundRect(x, y, w, h, arcWidth, arcHeight);
    
    Polygon polygon = new Polygon();
    polygon.addPoint(x, y);
    // ...continue adding points
    g2d.fillPolygon(polygon);

 

Related Examples

e587. Filling Basic Shapes

标签:start   can   struct   ons   example   wing   methods   table   phi   

原文地址:https://www.cnblogs.com/borter/p/9596078.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!