I know the below code is supposed to format the FormattedTextField but it doesn't seem to do anything to the form (shown in the picture below). I was wanting, when the form loaded: the text field to look something like this

00/00/2014 - 00:00 am


Where the user is able to

- enter datelike information around the symbol separators ( / or : )

- But where the user could not remove these symbol separators

Code:

package datefield;
Code:
    
    import javax.swing.JFormattedTextField;
    import javax.swing.text.DateFormatter;
    
    
    public class NewJFrame extends javax.swing.JFrame {
        
        public NewJFrame() {
            initComponents();
            formattedTextField();
        }
 
public void formattedTextField()
   {
        jFormattedTextField1 = new JFormattedTextField(new SimpleDateFormat("MM/dd/yy - mm:HH"));
        jFormattedTextField1.setValue(new Date());
        add(jFormattedTextField1);
   }
Name:  sO3em.png
Views: 417
Size:  6.2 KB