import java.awt.Font;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class Main extends JPanel {
public Main() {
DecimalFormat df = (DecimalFormat) NumberFormat.getInstance();
DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
dfs.setZeroDigit('\u0660');
df.setDecimalFormatSymbols(dfs);
JLabel label = new JLabel(df.format(1234567.89));
label.setFont(new Font("Lucida Sans", Font.PLAIN, 22));
add(label);
}
public static void main(String[] argv) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add("Center", new Main());
frame.pack();
frame.setVisible(true);
}
}
|