Giter VIP home page Giter VIP logo

swing-datetime-picker's Introduction

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

This project library do not available in maven central. so you can install with the jar library

  • Copy jar library file to the root project. exp : library/swing-datetime-picker-1.2.0.jar
  • Add this code to pom.xml
<dependency>
    <groupId>raven.datetime</groupId>
    <artifactId>swing-datetime-picker</artifactId>
    <version>1.2.0</version>
    <scope>system</scope>
    <systemPath>${basedir}/library/swing-datetime-picker-1.2.0.jar</systemPath>
</dependency>
  • Other library are use with this library
<dependency>
  <groupId>com.formdev</groupId>
  <artifactId>flatlaf</artifactId>
  <version>3.4.1</version>
</dependency>

<dependency>
  <groupId>com.formdev</groupId>
  <artifactId>flatlaf-extras</artifactId>
  <version>3.4.1</version>
</dependency>

<dependency>
    <groupId>com.miglayout</groupId>
    <artifactId>miglayout-swing</artifactId>
    <version>11.3</version>
</dependency>

Usage TimePicker

Method Return Value Description
now() void set the time to current local time
setSelectedTime(LocalTime time) void set the time to a specific value
clearSelectedTime() void clear the selected time
isTimeSelected() boolean check time is selected
getSelectedTime() LocalTime return the selected time
getSelectedTimeAsString() String return selected time as string
addTimeSelectionListener(TimeSelectionListener event) void add event time selection
removeTimeSelectionListener(TimeSelectionListener event) void remove event time selection
removeAllTimeSelectionListener() void remove all event tiem selection
setOrientation(int orientation) void SwingConstants.VERTICAL or SwingConstants.HORIZONTAL
setEditor(JFormattedTextField editor) void disply the selected time on the editor and allow to edit time
set24HourView(boolean hour24) void set time to 24h selection view
is24HourView() boolean return ture is 24h selection view
showPopup() void if time have editor, timepicker will show up with popup menu
closePopup() void close editor popup
setColor(Color color) void change base color
setEditorIcon(Icon icon) void change icon to editor

Usage DatePicker

Method Return Value Description
now() void set the date to current local date
setToBack() void slide panel to back with animation
setToForward() void slide panel to forward with animation
selectMonth() void show panel month slide with animation
selectYear() void show panel year slide with animation
slideTo(LocalDate date) void slide panel to specific date
getDateSelectionMode() DateSelectionMode return the date selectionmode
setDateSelectionMode(DateSelectionMode mode) void set mode SINGLE_DATE_SELECTED or BETWEEN_DATE_SELECTED
setSelectedDate(LocalDate date) void set the date to a specific value
setSelectedDateRange(LocalDate from, LocalDate to) void set the date range to a specific value
setEditor(JFormattedTextField editor) void disply the selected date on the editor and allow to edit date
setDateSelectionAble(DateSelectionAble dsb) void set date selectionable
showPopup() void if date have editor, datepicker will show up with popup menu
closePopup() void close editor popup
setSeparator(String separator) void set separator to between date
setUsePanelOption(boolean usePanelOption) void set datepicker use panel option
setCloseAfterSelected(boolean closeAfterSelected) void if true popup will close after selected date
clearSelectedDate() void 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) void add event date selection
removeDateSelectionListener(DateSelectionListener event) void remove event date selection
removeAllDateSelectionListener() void remove all event date selection
selectCurrentMonth() void select from first day to current day in current month
setEditorIcon(Icon icon) void change icon to editor

Library Resources

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

swing-datetime-picker's People

Contributors

dj-raven avatar rodrigocananea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

swing-datetime-picker's Issues

Change default blue color in Date picker

I know maybe this is not a very important request, but it looks like I need to change the color of the picker for the date. because it is very strange in the main color combination of my theme

How to change the date format displayed in the editor

        private JFormattedTextField dateText;
        dateText = new JFormattedTextField();
        DatePicker datePicker = new DatePicker();
        datePicker.setDateSelectionMode(DatePicker.DateSelectionMode.BETWEEN_DATE_SELECTED);
        datePicker.now();
        datePicker.setEditor(dateText);

I want to change the time display format,But my attempts to use setText or addDateSelectionListener didn't work

AM/PM Problem

Hello Ra-ven. Is there any possibility to correct the problem that exists in the TimePicker in 12Hs Mode in which the selected time is not reflected in the Formatted Field? This happens using the code downloaded from Github and also following the video code. Success in progress. Kind regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.