简体   繁体   中英

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. Most of the classes implementing Shape work with both Double and Float, except Polygon. 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?

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.

Also, take a look at the Graphics class, it has support for Polygon but not Shape , that was introduced into the Graphics2D class.

Am I correct in saying that I can achieve the same functionality with methods from Path2D and Area?

I would say, yes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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