[英]How to draw a clock with JavaFX 2?
Given an hour and a minute, I want to draw an analogous clock. 花了一个小时一分钟,我想绘制一个类似的时钟。
I was able to create a Group
with a Circle
, but I don't know which class to use for the hands and how to place and rotate them. 我能够创建一个带Circle
的Group
,但我不知道哪个类用于手以及如何放置和旋转它们。
I created a sample app implementing the above principles. 我创建了一个实现上述原则的示例应用程序 。
Update 更新
In response to criticism of the coding style used in the sample app, I created a refactored sample app which uses a more functional coding style. 为了回应对示例应用程序中使用的编码样式的批评 ,我创建了一个使用更多功能编码样式的重构示例应用程序 。
Additionally the jfxtras project has an AnalogueClock control. 此外, jfxtras项目还有一个AnalogueClock控件。 Here is the gist of how to use the jfxtras clock. 以下是如何使用jfxtras时钟的要点。
Netbeans 7.1.2 is bundled with sample applications. Netbeans 7.1.2与示例应用程序捆绑在一起。 In JavaFX part there is a StopWatch sample application. 在JavaFX部分中有一个StopWatch示例应用程序。 Have a look at it, it can give you a great clue. 看看它,它可以给你一个很好的线索。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.