Search code examples
javaswingx

Initialize JXDatePicker with custom date


I want to initialize a JXDatepicker with a custom date. At the moment I´m trying this:

    Date date1= new Date(2006-01-01);    
    Date date2 = new Date();
    jGeburtVon.setDate(date1);
    jGeburtBis.setDate(date2);`

Edited: this is the real code from the program ; it does compile and run and you´re right of course, new Date() initializes to today, not 01.01.1970. In this code though, date1 initializes to 01.01.1970.


Solution

  • I think the JXDatePicker method you're looking for is setDate(Date date)
    Javadoc for the JXDatePicker can be found here.