haoshuang3394 发表于 2013-2-5 01:27:46

Filling Basic Shapes:填充基本图形

<script>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}</script>
There are two ways to fill basic shapes like lines and rectangles.
#有两种方法来填充基本图形,像线和矩形
The first is to use specific drawing methods like Graphics.fillOval().
#第一种方法是使用特殊的画图方法,比如Graphics.fillOval()方法
This example uses these methods.
#这个例子试用了这些方法。
The second is to construct ashape and then use Graphics2D.fill() to fill the shape.
#第二个方法是构造一个图像,并且使用Graphics2D.fill()方法来填充图形
See thejava.awt.geom package for examples that create shapes.
#看java.awt.geom包,里面有很多关于创建图形的示例
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);
页: [1]
查看完整版本: Filling Basic Shapes:填充基本图形