I've discover this JDateChooser from searching how to use Item Combobox at Java Swing. Do you know how 开发者_开发知识库to install this?
Here is the link JDateChooser
I can't find any instructions on how to install it..
Can you share some instructions on how to install it... thanks in advance v(^_^)v
It's very simple.
Download the Toedter jcalendar-1.4.jar (also maven repository will locate it) If you are using Netbeans you can create an new bean and add the Toedter beans to your Palette Manager:
This gives you the capability to drag and drop these anywhere you like:
If you drag and drop the bean somewhere, the code that is generated looks like here:
jDateChooser1 = new com.toedter.calendar.JDateChooser();
jDateChooser1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jDateChooser1.setDateFormatString("dd/MM/yyyy");
You can then use the beans like this:
java.sql.Date di = rs.getDate("edate");
jDateChooser1.setDate(di);
or
java.util.Date jud = jDateChooser1.getDate();
long t = jud.getTime();
java.sql.Date sqd = new java.sql.Date(t);
rs.updateDate("edate", sqd);
or like this if you want to format the Date:
java.util.Date jud = jDateChooser1.getDate();
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MMMM dd, yyyy");
jLabel1.setText(sdf.format(jud));
Add the sources to yours and use the classes like in JCalendarDemo.java
精彩评论