Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.text.ParseException;
import javax.swing.JFormattedTextField;
import javax.swing.text.DefaultFormatterFactory;

import javax.swing.text.MaskFormatter;

public class Main {
    public static void setDataMask(JFormattedTextField textField) {
        try {
            MaskFormatter mask = new MaskFormatter("##/##/####");
            textField.setFormatterFactory(new DefaultFormatterFactory(mask));
        } catch (ParseException e) {
            e.printStackTrace();
        }

    }
}