Java Swing Text Format format(String pattern, Object value)

Here you can find the source of format(String pattern, Object value)

Description

format

License

Open Source License

Declaration

private static String format(String pattern, Object value) 

Method Source Code

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

import java.text.ParseException;

import javax.swing.text.MaskFormatter;

public class Main {
    private static String format(String pattern, Object value) {
        MaskFormatter mask;/*from  w  ww .ja va 2  s.co  m*/
        try {
            mask = new MaskFormatter(pattern);
            mask.setValueContainsLiteralCharacters(false);
            return mask.valueToString(value);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. dataFormatada(Calendar cal)
  2. findElementUp(String name, Element start)
  3. findMatchingBracket(Element el, int offset)
  4. findNext(boolean reverse, int pos)
  5. formartCpf(String cpf)
  6. formata(String s, String mascara)
  7. formatAreaImperial(BigDecimal areaDec)
  8. formatAreaMetric(BigDecimal area)
  9. formatCEP(String str)