What are good Java date-chooser Swing GUI widgets?

前端 未结 5 799
醉话见心
醉话见心 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: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());
    

提交回复
热议问题