首页 > 其他 > 详细

e587. Filling Basic Shapes

时间:2018-09-06 10:07:35      阅读:182      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!