Changing Demonstrated Texts (Strings) of DatePicker in JavaFX

I would like to change some of the values ​​shown DatePicker

in JavaFX

.

For example, take a look at the image below: The picture is downloaded from Oracle Web Site

If I want to change the color and text of the DateCell

current date, it seems very simple, because you can do it with the code below:

private DatePicker dateTest = new DatePicker();
final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>()
        {
            public DateCell call(final DatePicker datePicker)
            {
                return new DateCell()
                {
                    @Override
                    public void updateItem(LocalDate item, boolean empty)
                    {
                        super.updateItem(item, empty);

                        if (MonthDay.from(item).equals(MonthDay.of(9, 13)))
                        {
                            setTooltip(new Tooltip("It going to be change"));
                            setStyle("-fx-background-color: #ff4444;");
                            setText("Elyas");
                        }
                        if (item.equals(LocalDate.now().plusDays(1)))
                        {
                            // Tomorrow is too soon.
                            setDisable(true);
                        }
                    }
                };
            }
        };
  dateTest.setDayCellFactory(dayCellFactory);

      

the result of the above codes becomes something like this: enter image description here

so that you can see the text and color change DateCell

(in this case the 25th from September) is not very difficult.

but my question is, how can I change the other part DatePikcer

? For example, I would like to change

"September" to "Hello"

"sun" to "1"

"mon" to "2"

"2013" in "container of the year"

+3


source to share





All Articles