Sad to say, there is no such control in Java FX 2. However, Java FX 8 has one. Then again, if you want to maintain your rule that you must never force the user to update to the latest version just to be able to see a date picker, the only option is to make one.

Luckily, somebody else did the dirty work for us. Marko Jacob extended a more flexible version from Christian Schudt and it works flawlessly. Plus, using it is fairly easy too.

The downside to this is that you cannot import this control in the Java FX Scene Builder. You will have to add the DatePicker control programmatically.

javafx-date-picker

Download his JavaFX Date Picker Release on GitHub.

If ever this will happen to you, chances are you used a bean class as the object passed to the ObservableList. Hence, any update done will not update your TableView unless it is binded to that bean class.

To do so, replace your data types like long, int, double to use the Property class and instantiate it with SimpleProperty class. For String, use StringProperty and instantiate it with SimpleStringProperty.

Check this sample class:

Your bean class must have a Property method that will return the property class in order for binding to take effect with your TableView and ObservableList. This is so that the values of the individual entity fields can be observed for changes and any update action will take effect.

Here is my version of a confirm dialog window that shows a Yes and No button. The class also includes a key listener to close the window in case the user presses the ESC key. This is equivalent to pressing the No button.

This is how it looks like.


And here is the code.

And this is the content of the CSS file.

Related Posts Plugin for WordPress, Blogger...