Java 如何使用 drawArc()
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23833765/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to use drawArc()
提问by Altiano Gerung
i want to draw this arc in a panel that the preferedSize is set to (200,50):
我想在首选大小设置为 (200,50) 的面板中绘制此弧:
i found it hard to understand what does the parameters in drawArc()
. how to draw this one?
我发现很难理解drawArc()
. 这个怎么画?
采纳答案by DirkyJerky
To understand the arguements read the javadoc: http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics.html#drawArc(int,%20int,%20int,%20int,%20int,%20int)
要了解争论阅读 javadoc:http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics.html#drawArc(int,%20int,%20int,%20int,%20int , %20int)
回答by working
drawArc(int x, int y, int width, int length, int startAngle, int arcAngle)
Used to draw an arc inside an imaginary rectangle whose upper left corner is at (x,y). The arc is drawn from the startAngle to startAngle + arcAngle and is measured in degrees. A startAngle of 0o points horizontally to the right (like the unit circle in math). Positive is a counterclockwise rotation starting at 0o
用于在左上角位于 (x,y) 的假想矩形内绘制圆弧。弧线是从 startAngle 到 startAngle + arcAngle 绘制的,以度为单位。0o 的 startAngle 水平指向右侧(就像数学中的单位圆)。正是从 0o 开始逆时针旋转