Java is another Animal III: using another external Libraries: JDatePicker

While Java allows the use of different Swing tools without any limitation it is needed to know how to handle this. First of all: the Tool has to be downloaded, mostly as a jar file. In our case we try JDatePaicker located at https://jdatepicker.org/
With this tool we want to use the Date picking like it is available for Xojo as a commercial plugin. JDatepicker is free for private and commercial use!
Download the jar File from the repository and then add the jar to your project, in IntelliJIdea you open the Project Structure and choose Libraries. I use for this the project we generated for Look and feel change where the flatlaf jar is also in the Libraries but not needed for this tutorial. It is only there.


Now choose + and then Java, then choose the JDatePicker jar and add it to your Module, it should look like this:

Now we will add the JDatepicker as Bean to JFormdesigner. For that open the Design with Double clicking on the Form jfd File and go with the mouse above “Custom” and do a right click, select add Bean, this Window pops up:

Type into the Search Bar JDate and the IDE gives you two choices: JDatePanel and JDatePicker. We choose JDatepicker:


Click ok and you find JDatePanel in your Menue. Select it and place the JDatePicker on your Screen:

Like you can see: it is an old Library but still supported. As far as I can see even for Java 17 (I was testing with the preview). But there are many many Java Swing Components which you can get free for use. And the mechanicm to use is in most of the cases the same.

As you can see: the Datepicker is to old for us. We need some fresh meat. Let’s try LGoodDatePicker. I have downloaded the jar file at: Releases · LGoodDatePicker/LGoodDatePicker · GitHub and load like described above:
image
and also added it to our Java JFormDesigner as Custom, for this Search in Panel for DatePicker and select the LGood Datepicker Class like this:


Now add it to our Design like this:

And press the green RUN Arrow. The Window comes up like this:
image
Pressing on the … Bar does this:
image
There is a big Amount of Components you can simply use with JFormDesigner and Java Swing. Have Fun.

Something to note IF you did not remove jDatepicker from the project you may get a conflictt as both have a class name DatePicker so its ambiguous
In my case I had to remove the jDatePicker AND the IMPRT at the beginning of the code

Just have to read the error message closely to see what it says the problem is to know how to fix it !

The cool part about this is that you can use “per project plugins” quite simply

Ahh okay I did not get an errormessage. Thank you

So I was implementing both on one Site. Made no errors. Needed is that you use in your code all time the entire class name. IntelliJ is helping you with that.


Like you can see: there are more Classes named DatePicker but they have their unique Classpath all time. So I can not get why you got an error message. Maybe while Selected the wrong Class somehow. I would like to have the Source code for that.