如何在Java中绘制或填充梯形?

huangapple go评论54阅读模式
英文:

How do I draw or fill a trapezoid in java?

问题

所以,你知道在Java中有某些方式可以创建形状,对吧?例如,有fillRect()和drawRect()。是否有任何方法可以用来创建梯形?就像fillTrap或drawTrap一样?我是12年级的计算机科学学生,但在Java方面经验不是很丰富。

英文:

So, you know how there are certain ways you can create shapes in Java, right? For example, there's fillRect() and drawRect(). Is there any way I can do the same thing but for a trapezoid? Like, fillTrap or drawTrap? I'm a grade 12 comp sci student, but I'm not that experienced with Java in particular.

答案1

得分: 2

没有 drawTrap 或者 fillTrap 方法,但是有:

drawPolygon(int[] x, int[] y, int numberofpoints)

所以现在你可以用纸和笔为一个多边形定义一些点,然后将它们代入我给你的方法中。

英文:

There is no drawTrap or fillTrap method, but there is :

drawPolygon(int[] x, int[] y, int numberofpoints)

So now using a pen and paper, you can define some points for a polygon and substitute them into the method I gave you.

huangapple
  • 本文由 发表于 2020年10月2日 23:29:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/64174281.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定