Example usage for javax.swing.text MaskFormatter setPlaceholder

List of usage examples for javax.swing.text MaskFormatter setPlaceholder

Introduction

In this page you can find the example usage for javax.swing.text MaskFormatter setPlaceholder.

Prototype

public void setPlaceholder(String placeholder) 

Source Link

Document

Sets the string to use if the value does not completely fill in the mask.

Usage

From source file:br.com.pontocontrol.controleponto.util.SwingUtils.java

public static void setMask(JFormattedTextField field, String mask) {
    try {/* w  w  w  .j a  v  a 2 s.c o  m*/
        MaskFormatter maskFormatter = new MaskFormatter(mask);
        maskFormatter.setPlaceholder("");
        maskFormatter.install(field);
    } catch (ParseException ex) {
        LOG.log(Level.SEVERE, "Erro ao definir mscara no campo", ex);
    }
}