RepositoryJavaKHCambodia
DJ-Raven

DJ-Raven/swing-datetime-picker

Java swing flatlaf datetime picker

85stars
17forks
1issues
2views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: datepicker

#1 Repository of the month

1
TINIX TRENDING·Topic: datetimepicker

#1 Repository of the month

1
TINIX TRENDING·Topic: timepicker

#1 Repository of the month

Swing Datetime Picker

A simple datetime picker implementation using Java Swing, built with the flatlaf UI library and miglayout for layout management.

This project provides a datetime picker component that can be easily integrated into Java Swing applications. It leverages flatlaf for a modern look and miglayout for flexible and easy-to-use layout management.

timepicker dark  timepicker light
datepicker dark  datepicker light

Installation

Maven Central

Add the dependency

<dependency>
    <groupId>io.github.dj-raven</groupId>
    <artifactId>swing-datetime-picker</artifactId>
    <version>2.1.3</version>
</dependency>

Snapshots

To get the latest updates before the release, you can use the snapshot version from Sonatype Central

<repositories>
    <repository>
        <name>Central Portal Snapshots</name>
        <id>central-portal-snapshots</id>
        <url>https://central.sonatype.com/repository/maven-snapshots/</url>
    </repository>
</repositories>

Add the snapshot version

<dependency>
    <groupId>io.github.dj-raven</groupId>
    <artifactId>swing-datetime-picker</artifactId>
    <version>2.1.4-SNAPSHOT</version>
</dependency>

Usage TimePicker

MethodReturn ValueDescription
now()set the time to current local time
setSelectedTime(LocalTime time)set the time to a specific value
clearSelectedTime()clear the selected time
isTimeSelected()booleancheck time is selected
getSelectedTime()LocalTimereturn the selected time
getSelectedTimeAsString()Stringreturn selected time as string
addTimeSelectionListener(TimeSelectionListener event)add event time selection
removeTimeSelectionListener(TimeSelectionListener event)remove event time selection
setOrientation(int orientation)SwingConstants.VERTICAL or SwingConstants.HORIZONTAL
setEditor(JFormattedTextField editor)display the selected time on the editor and allow to edit time
setTimeSelectionAble(TimeSelectionAble dsb)set time selection able
set24HourView(boolean hour24)set time to 24h selection view
is24HourView()booleanreturn ture is 24h selection view
showPopup()if time have editor, timepicker will show up with popup menu
closePopup()close editor popup
setColor(Color color)change base color
setEditorIcon(Icon icon)change icon to editor
setEditorValidation(boolean validation)validation editor
void setValidationOnNull(boolean validationOnNull)validation editor on null selection
void showPopup(Component component)show timePicker with popup without editor
void setPopupSpace(Point popupSpace)set the popup space with component or editor
void toDateSelectionView()show date selection state

Usage DatePicker

MethodReturn ValueDescription
now()set the date to current local date
setToBack()slide panel to back with animation
setToForward()slide panel to forward with animation
selectMonth()show panel month slide with animation
selectYear()show panel year slide with animation
slideTo(LocalDate date)slide panel to specific date
getDateSelectionMode()DateSelectionModereturn the date selection mode
setDateSelectionMode(DateSelectionMode mode)set mode SINGLE_DATE_SELECTED or BETWEEN_DATE_SELECTED
setSelectedDate(LocalDate date)set the date to a specific value
setSelectedDateRange(LocalDate from, LocalDate to)set the date range to a specific value
setEditor(JFormattedTextField editor)display the selected date on the editor and allow to edit date
setDateSelectionAble(DateSelectionAble dsb)set date selection able
showPopup()if date have editor, datepicker will show up with popup menu
closePopup()close editor popup
setSeparator(String separator)set separator to between date
setUsePanelOption(boolean usePanelOption)set datepicker use panel option
setCloseAfterSelected(boolean closeAfterSelected)if true popup will close after selected date
clearSelectedDate()clear the selected date
isDateSelected()booleancheck date is selected
getSelectedDate()LocalDatereturn the selected date
getSelectedDateRange()LocalDate[]return the selected date range
getSelectedDateAsString()Stringreturn selected date as string
addDateSelectionListener(DateSelectionListener evt)add event date selection
removeDateSelectionListener(DateSelectionListener evt)remove event date selection
selectCurrentMonth()select from first day to current day in current month
setColor(Color color)change base color
setEditorIcon(Icon icon)change icon to editor
setDateFormat(String format)change date format
setEditorValidation(boolean validation)validation editor
void setValidationOnNull(boolean validationOnNull)validation editor on null selection
void setAnimationEnabled(boolean animationEnabled)enable or disabled the animation
void setPanelDateOptionLabel(PanelDateOptionLabel opt)set new panel date option label
void setStartWeekOnMonday(boolean startWeekOnMonday)show the monday is the start of the week
void showPopup(Component component)show datePicker with popup without editor
void setPopupSpace(Point popupSpace)set the popup space with component or editor
void setHourSelectionView(boolean hourSelectionView)show hour or minute selection state
void setSelectionArc(float selectionArc)set date selection border arc
void setDefaultDateCellRenderer(DefaultDateCellRenderer renderer)set date cell renderer to paint custom graphics
public static void setDefaultWeekdays(String[] defaultWeekdays)static method for set default label week days
public static void setDefaultMonths(String[] defaultMonths)static method for set default label months
public static String[] getDefaultWeekdays()static method for get default label week days
public static String[] getDefaultMonths()static method for get default label months

Library Resources

  • FlatLaf - FlatLaf library for the modern UI design theme
  • MigLayout - MigLayout library for flexible layout management

Similar Projects

Discover other similar projects and AI models.

RepositoryTypeScript
Vuepic/vue-datepicker

Datepicker component for Vue 3

1.8k
Nov 23, 2026
RepositoryKotlin
loper7/DateTimePicker

⭐🎉一个高颜值日期时间选择器;极简API,内置弹窗,支持农历日期显示,适配深色模式,可动态配置样式及主题,选择器支持完全自定义UI。

1.3k
May 11, 2023
RepositoryJavaScript
ciaoca/cxCalendar

JavaScript date picker, support range, time, year, month. JavaScript 日期选择器插件,支持范围、日期、时间、月份、年份等多种类型。

169
Jun 1, 2023
RepositoryJava
Bigkoo/Android-PickerView

This is a picker view for android , support linkage effect, timepicker and optionspicker.(时间选择器、省市区三级联动)

13.4k
Dec 30, 2022
RepositoryJava
gzu-liyujiang/AndroidPicker

安卓选择器类库,包括日期及时间选择器(可用于出生日期、营业时间等)、单项选择器(可用于性别、民族、职业、学历、星座等)、二三级联动选择器(可用于车牌号、基金定投日期等)、城市地址选择器(分省级、地市级及区县级)、数字选择器(可用于年龄、身高、体重、温度等)、日历选日期择器(可用于酒店及机票预定日期)、颜色选择器、文件及目录选择器、图片选择器等……WheelPicker/DatePicker/TimePicker/OptionPicker/NumberPicker/LinkagePicker/AddressPicker/CarPlatePicker/CalendarPicker/ColorPicker/FilePicker/ImagePicker etc.

6.8k
Mar 21, 2026
RepositoryJava
JFormDesigner/FlatLaf

FlatLaf - Swing Look and Feel (with Darcula/IntelliJ themes support)

4.3k
Nov 30, 2026
RepositoryJava
DJ-Raven/swing-modal-dialog

Java Swing UI library custom with FlatLaf

158
Sep 24, 2026
RepositoryJava
DJ-Raven/swing-toast-notifications

Swing toast notifications use for java desktop application

108
Nov 20, 2024
RepositoryJava
DJ-Raven/flatlaf-dashboard

Java Swing Dashboard build with flatlaf look and feel

100
Feb 13, 2025