Hi,
I have this problem with the code below using JFormattedTextField with SimpleDateFormat. I can't insert a 1 on the month field or a 3 on the day field.
Thanks for your help!
///////////////////////////////////////////////////////////////////////
import java.awt.*;
import java.text.*;
import java.util.*;
import javax.swing.*;
import javax.swing.text.*;
public class Test {
public static void main(String[] args) {
SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy"
;
format.setLenient(false);
JFormattedTextField ftf = new JFormattedTextField(format);
((DateFormatter) ftf.getFormatter()).setAllowsInvalid(false);
((DateFormatter) ftf.getFormatter()).setOverwriteMode(true);
ftf.setValue(new Date());
Frame f = new Frame();
f.add(ftf);
f.setVisible(true);
}
}
I have this problem with the code below using JFormattedTextField with SimpleDateFormat. I can't insert a 1 on the month field or a 3 on the day field.
Thanks for your help!
///////////////////////////////////////////////////////////////////////
import java.awt.*;
import java.text.*;
import java.util.*;
import javax.swing.*;
import javax.swing.text.*;
public class Test {
public static void main(String[] args) {
SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy"
format.setLenient(false);
JFormattedTextField ftf = new JFormattedTextField(format);
((DateFormatter) ftf.getFormatter()).setAllowsInvalid(false);
((DateFormatter) ftf.getFormatter()).setOverwriteMode(true);
ftf.setValue(new Date());
Frame f = new Frame();
f.add(ftf);
f.setVisible(true);
}
}