Reputation: 467
I am using JDateChooser from jcalendar-1.2.2 jar. I have set dateformatString as "yyyyMMdd".By default it is showing today's date September 1, 2010. whenever I try to change the date it is displayed correctly in yyyyMMdd format. How to set default format for default date (todate).
Upvotes: 0
Views: 312
Reputation: 18812
Is this what you are trying to get ?
public class TestJFrame extends JFrame {
/**
*
*/
public TestJFrame() {
//set test frame
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setPreferredSize(new Dimension(100,100));
//make a date chooser
JDateChooser dateChooser = new JDateChooser();
//set date format
dateChooser.setDateFormatString("yyyyMMdd");
//set date
dateChooser.setDate(new Date());
//add to test frame
getContentPane().add(dateChooser);
pack();
setVisible(true);
}
/**
* @param args
*/
public static void main(String[] args) {
new TestJFrame();
}
}
It may help you find what's wrong.
Upvotes: 2