简体   繁体   English

为什么java.awt.Polygon仅适用于整数?

[英]Why does java.awt.Polygon only work with integers?

I'm doing a project in which I use the AWT library with shapes a lot. 我正在做一个项目,其中我经常使用带有形状的AWT库。 Most of the classes implementing Shape work with both Double and Float, except Polygon. 除Polygon之外,大多数实现Shape的类都可以使用Double和Float。 Why? 为什么? Why in Gods name and grace?! 为什么要以上帝的名义和恩典?

Am I correct in saying that I can achieve the same functionality with methods from Path2D and Area? 我是否正确地说我可以使用Path2D和Area中的方法实现相同的功能?

Most of all I am wondering the why aspect of it all. 最重要的是,我想知道为什么这一切。

Because Polygon has been apart of the API since version 1.0, the Shape API was introduced in version 1.2 and Polygon was updated to meet the basic requirements of the Shape API. 由于Polygon自1.0版以来就是API的一部分,因此Shape API是在1.2版中引入的,并且更新了Polygon以满足Shape API的基本要求。

Also, take a look at the Graphics class, it has support for Polygon but not Shape , that was introduced into the Graphics2D class. 另外,看看Graphics类,它具有对Polygon支持,但不具有Shape支持,该支持是Graphics2D类中引入的。

Am I correct in saying that I can achieve the same functionality with methods from Path2D and Area? 我是否正确地说我可以使用Path2D和Area中的方法实现相同的功能?

I would say, yes. 我会说,是的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM