Example usage for java.text DecimalFormatSymbols setZeroDigit

List of usage examples for java.text DecimalFormatSymbols setZeroDigit

Introduction

In this page you can find the example usage for java.text DecimalFormatSymbols setZeroDigit.

Prototype

public void setZeroDigit(char zeroDigit) 

Source Link

Document

Sets the character used for zero.

Usage

From source file:Main.java

public static void main(String[] argv) {
    DecimalFormat df = (DecimalFormat) NumberFormat.getInstance();
    DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();

    dfs.setZeroDigit('\u0660');
    df.setDecimalFormatSymbols(dfs);/*from  w ww .j  a v  a  2s  .  c  om*/

    System.out.println(df.format(1234567.89));
}

From source file:ArabicDigitsI18N.java

public ArabicDigitsI18N() {
    DecimalFormat df = (DecimalFormat) NumberFormat.getInstance();
    DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();

    dfs.setZeroDigit('\u0660');
    df.setDecimalFormatSymbols(dfs);/*from w  ww.  j a  v a 2s.  c o  m*/

    JLabel label = new JLabel(df.format(1234567.89));

    label.setFont(new Font("Lucida Sans", Font.PLAIN, 22));
    add(label);
}

From source file:Main.java

public Main() {
    DecimalFormat df = (DecimalFormat) NumberFormat.getInstance();
    DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();

    dfs.setZeroDigit('\u0660');
    df.setDecimalFormatSymbols(dfs);//w  ww . j a v a 2  s .  co  m

    JLabel label = new JLabel(df.format(1234567.89));

    label.setFont(new Font("Lucida Sans", Font.PLAIN, 22));
    add(label);
}

From source file:MainClass.java

public MainClass() {
    NumberFormat nf = NumberFormat.getInstance();
    if (nf instanceof DecimalFormat) {
        DecimalFormat df = (DecimalFormat) nf;
        DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();

        // set the beginning of the range to Arabic digits
        dfs.setZeroDigit('\u0660');
        df.setDecimalFormatSymbols(dfs);
    }/*from  www . j a va 2s.  co  m*/

    JLabel label = new JLabel(nf.format(1234567.89));

    label.setFont(new Font("Lucida Sans", Font.PLAIN, 22));
    add(label);
}