Example usage for javax.swing JFormattedTextField addMouseListener

List of usage examples for javax.swing JFormattedTextField addMouseListener

Introduction

In this page you can find the example usage for javax.swing JFormattedTextField addMouseListener.

Prototype

public synchronized void addMouseListener(MouseListener l) 

Source Link

Document

Adds the specified mouse listener to receive mouse events from this component.

Usage

From source file:org.yccheok.jstock.gui.NewBuyTransactionJDialog.java

private JFormattedTextField getCurrencyJFormattedTextField() {
    NumberFormat format = NumberFormat.getNumberInstance();
    format.setMaximumFractionDigits(4);//from w w  w  .  j a v a 2s  . c  o m
    NumberFormatter formatter = new NumberFormatter(format);
    formatter.setMinimum(0.0);
    formatter.setValueClass(Double.class);
    JFormattedTextField formattedTextField = new JFormattedTextField(formatter);
    formattedTextField.addMouseListener(getJFormattedTextFieldMouseListener());
    return formattedTextField;
}

From source file:org.yccheok.jstock.gui.NewSellTransactionJDialog.java

private JFormattedTextField getCurrencyJFormattedTextField(boolean isNegativeAllowed) {
    NumberFormat format = NumberFormat.getNumberInstance();
    format.setMaximumFractionDigits(4);//  w w w .j  a  va2 s.com
    NumberFormatter formatter = new NumberFormatter(format);

    if (isNegativeAllowed == false)
        formatter.setMinimum(0.0);
    else
        formatter.setMinimum(null);

    formatter.setValueClass(Double.class);
    JFormattedTextField formattedTextField = new JFormattedTextField(formatter);
    formattedTextField.addMouseListener(getJFormattedTextFieldMouseListener());
    return formattedTextField;
}

From source file:org.yccheok.jstock.gui.portfolio.AutoDividendJDialog.java

private JFormattedTextField getCurrencyJFormattedTextField() {
    NumberFormat format = NumberFormat.getNumberInstance();
    format.setMaximumFractionDigits(3);// w w  w .  j av  a 2 s  . c om
    NumberFormatter formatter = new NumberFormatter(format);
    formatter.setMinimum(0.0);
    formatter.setValueClass(Double.class);
    JFormattedTextField formattedTextField = new JFormattedTextField(formatter);
    formattedTextField.addMouseListener(getJFormattedTextFieldMouseListener());
    return formattedTextField;
}