JavaFX equivalent of Swing's JSpinner?

2019-02-17 03:07发布

I was trying to find a spinner component like JSpinner to use in my JavaFX application but there is no such component.

What JavaFX component do you recommend me to use in place of a spinner?

3条回答
Luminary・发光体
2楼-- · 2019-02-17 03:38

You can also check and follow my initial approach to the spinner implementation problem, which you can find here: https://github.com/bluevoxel/Custom_Spinner_JavaFX8/wiki

And thats how it looks like:

enter image description here

Its functionality is constantly expanding, so I will be very grateful for your feedback.

UPDATE 4/11/2014

There is a new version available with expanded functionality including doubles, additional customizable ContextMenu class for choosing the incrementation value, additional method for uploading custom functionality to increase/decrease buttons. Check the link below to know more:

https://gist.github.com/bluevoxel/c730a101ba812728a235

Also, there is a new outlook lack of external image files:

enter image description here

查看更多
Luminary・发光体
3楼-- · 2019-02-17 03:50

JavaFX 8 has a Spinner class. (but earlier versions haven't)

查看更多
一纸荒年 Trace。
4楼-- · 2019-02-17 04:00

Update for Java 8

JavaFX 8 has now an in-built Spinner class as part of the core JavaFX library (as mentioned in SWdV's answer to this question).

Old (pre-Java 8) Answer

There is a spinner control in the JFXtras library, you could use that implementation or possibly adapt it to your needs.

A spinner control is proposed for inclusion in a future JavaFX version. The target version is currently unspecified, so perhaps it won't even be released with Java 8. The proposed spinner control has a usability design document. The open-jfx project may accept a quality implementation of the usability design for inclusion into the core JavaFX platform or the JavaFX UI Control Sandbox.

查看更多
登录 后发表回答