如何实现波斯日历 [英] How to implement Persian Calendar

查看:110
本文介绍了如何实现波斯日历的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在JavaFx上是否有波斯日历DatePicker的实现?

Is there any implementation of Persian calendar DatePicker on JavaFx?

在DatePicker上没有波斯chronology可用于获得波斯日历

There is no Persian chronology to use on DatePicker to achieve a Persian calendar

推荐答案

我现在开发了一种现成的日历选择器,该选择器还提供了波斯日历.它最初的灵感来自克里斯汀·舒特(Christian Schudt)的出色作品,但经过完全重写和增强.只需下载我的库 Time4J -v4.20(或更高版本,在Maven中可用)并使用此代码演示:

I have now developed a ready-to-use calendar picker which also offers a persian calendar. It was originally inspired by the nice work of Christian Schudt, but completely rewritten and enhanced. Just download my library Time4J-v4.20 (or later, available in Maven) and use this code demo:

CalendarPicker<PersianCalendar> picker = picker.persianWithSystemDefaults();

picker.setLengthOfAnimations(Duration.seconds(0.7));
picker.setShowInfoLabel(true);
picker.setLocale(new Locale("fa", "IR"));
picker.setShowWeeks(true);

picker.setCellCustomizer(
  (cell, column, row, model, date) -> {
    if (CellCustomizer.isWeekend(column, model)) {
      cell.setStyle("-fx-background-color: #FFE0E0;");
      cell.setDisable(true);
    }
  }
);

您还可以设置其他属性,例如最短日期和最长日期.这是使用波斯语和伊朗本地化星期模型的示例图像.您可以浏览波斯语的所有月份,年份或十年(通过单击页眉),也可以跳转到当前日期(通过单击页脚).

You can also set other properties like minimum and maximum date. Here an example image using Farsi language and a localized week model for Iran. You can navigate through all Persian months, years or decades (by clicking on the header) or jump to current date (by clicking on the footer).

这篇关于如何实现波斯日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆