import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.text.NumberFormat;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter;
public class Main extends JPanel implements PropertyChangeListener {
double amount = 100000;
JFormattedTextField amountField;
NumberFormat amountDisplayFormat;
NumberFormat amountEditFormat;
public Main() {
super(new BorderLayout());
amountDisplayFormat = NumberFormat.getCurrencyInstance();
System.out.println(amountDisplayFormat.format(1200));
amountDisplayFormat.setMinimumFractionDigits(0);
amountEditFormat = NumberFormat.getNumberInstance();
amountField = new JFormattedTextField(new DefaultFormatterFactory(
new NumberFormatter(amountDisplayFormat), new NumberFormatter(
amountDisplayFormat), new NumberFormatter(amountEditFormat)));
amountField.setValue(new Double(amount));
amountField.setColumns(10);
amountField.addPropertyChangeListener("value", this);