What are good Java date-chooser Swing GUI widgets?

前端 未结 5 774
醉话见心
醉话见心 2020-12-07 23:22

What are good Java Swing date-chooser components? So far I\'ve only really found these 2:

  • JCalendar - this one is pretty good as it uses the underlying look an
相关标签:
5条回答
  • 2020-12-07 23:28

    Recently I found and use the Microba DatePicker (http://microba.sourceforge.net/) for a personal project involving Swing GUIs, and I actually I really liked the way this control is implemented. Besides, the license is BSD, so you will be able to customize the control and use it for commercial purposes if you need to do so.

    0 讨论(0)
  • 2020-12-07 23:38

    I'm often late but the best i've seen is : JDatePicker

    (What has surprised me : week start with Sunday - like many Calendar and by the way Sunday is day 0 in Java - but you can edit the source and recompile to get it start with Monday instead ;-) )

    0 讨论(0)
  • 2020-12-07 23:38

    There is also NachoCalendar.

    0 讨论(0)
  • 2020-12-07 23:40

    jDateChooser which comes with jCalendar is the best component for date: Following is the way to get date from date picker:

    //dat is name given to datepicker component
    int day=dat.getJCalendar().getDayChooser().getDay();
    int month=dat.getJCalendar().getMonthChooser().getMonth();
    int year=dat.getJCalendar().getYearChooser().getYear();
    String dateNow=year+"/"+month+"/"+day;
    System.out.println(dateNow);
    
    //***************************************************
    //For setting date of date picker:
    dat.setDateFormatString("dd-MM-yyyy");
    Calendar currentDate = Calendar.getInstance();
    dat.setDate(currentDate.getTime());
    
    0 讨论(0)
  • 2020-12-07 23:49

    I've tried most of the date pickers out there.
    I would suggest LGoodDatePicker.

    https://github.com/LGoodDatePicker/LGoodDatePicker

    Fair disclosure: I am the primary developer.

    Here is a general feature list (as adapted from Github):

    • Automatic internationalization.
    • Uses the (new) standard Java 8 time package. Also called "java.time" or "JSR-310".
    • Automatic validation of dates.
    • Fonts and colors can be changed.
    • Optional highlight policies and veto policies.
    • Relatively compact source code (3 core classes).
    • Creating a DatePicker requires only one line of code.
    • Demo program and code samples included.
    • Good Javadocs.
    • Open source license.

    Screenshots below:

    LGoodDatePicker Screenshots

    0 讨论(0)
提交回复
热议问题