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.
<dependency>
<groupId>io.github.dj-raven</groupId>
<artifactId>swing-datetime-picker</artifactId>
<version>1.4.0</version>
</dependency>
To get the latest updates before the release, you can use the snapshot version from Sonatype OSS Snapshots
<repositories>
<repository>
<id>sonatype-oss-snapshots</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
Add the snapshot version
<dependency>
<groupId>io.github.dj-raven</groupId>
<artifactId>swing-datetime-picker</artifactId>
<version>1.4.1-SNAPSHOT</version>
</dependency>
boolean
return
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
Method
Return Value
Description
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)
disply the selected date on the editor and allow to edit date
setDateSelectionAble(DateSelectionAble dsb)
set date selectionable
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()
boolean
check date is selected
getSelectedDate()
LocalDate
return the selected date
getSelectedDateRange()
LocalDate[]
return the selected date range
getSelectedDateAsString()
String
return selected date as string
addDateSelectionListener(DateSelectionListener event)
add event date selection
removeDateSelectionListener(DateSelectionListener event)
remove event date selection
removeAllDateSelectionListener()
remove all 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