Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.swing.JFormattedTextField;
import javax.swing.text.DateFormatter;

public class Main {
    public static void main(String[] argv) {
        JFormattedTextField f = new JFormattedTextField(new SimpleDateFormat("yyyy-M-d"));
        f.setValue(new Date());

        DateFormatter fmt = (DateFormatter) f.getFormatter();
        fmt.setFormat(new SimpleDateFormat("d/M/yyyy"));

        f.setValue(f.getValue());
    }
}