`

Drawing 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 draw basic shapes like lines and rectangles.

The first is to use specific drawing methods like

Graphics.drawOval(). This example uses these methods. The

second is to construct a shape and then use Graphics2D.draw() to

draw the shape. See the java.awt.geom package for examples that

create shapes.

g2d.drawLine(x1, y1, x2, y2);

g2d.drawArc(x, y, w, h, startAngle, arcAngle);

g2d.drawOval(x, y, w, h);

g2d.drawRect(x, y, w, h);

g2d.drawRoundRect(x, y, w, h, arcWidth, arcHeight);

Polygon polygon = new Polygon();

polygon.addPoint(x, y);

// ...continue adding points

g2d.drawPolygon(polygon);

分享到:
评论

相关推荐

    环境工程CAD绘图 3 绘制基本二维图形.pdf

    绘制基本二维图形是环境工程CAD绘图的基础,drawing basic two-dimensional shapes is the foundation of environmental engineering CAD drawing。 在环境工程CAD绘图中,绘制基本二维图形是非常重要的,because ...

    iOS的图像和动画处理

    还包括了对Xcode项目结构的创建(Creating the Project Structure in Xcode),基本概念的适应不同屏幕尺寸(Basic Concepts for Adapting to Different Screen Sizes),以及更深层次的图形上下文使用技巧。...

    visio教程PDF

    6.3 创建基本图形并进行格式化 6.3.1 使用矩形和椭圆工具 6.3.2 设定圆角 6.3.3 使用填充色 6.3.4 改变填充样式 6.3.5 应用填充模式 6.3.6 创建阴影 6.4 使用键盘快捷方式 6.5 小结 第7章 ...

    Visio 2000 技术大全

    6.3 创建基本图形并进行格式化 6.3.1 使用矩形和椭圆工具 6.3.2 设定圆角 6.3.3 使用填充色 6.3.4 改变填充样式 6.3.5 应用填充模式 6.3.6 创建阴影 6.4 使用键盘快捷方式 6.5 小结...

    Visual C++ 编程资源大全(英文源码 图形)

    basic_directx.zip Basic DirectX + MFC game project template 基本的DirectX+MFC开发游戏项目模板(15KB)&lt;END&gt;&lt;br&gt;88,dashline.zip A Simple Dash-Line Class 画大于1个逻辑单位的虚点线(46KB)&lt;END&gt;...

Global site tag (gtag.js) - Google Analytics