Example usage for javax.swing JFormattedTextField JFormattedTextField

List of usage examples for javax.swing JFormattedTextField JFormattedTextField

Introduction

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

Prototype

public JFormattedTextField(AbstractFormatterFactory factory) 

Source Link

Document

Creates a JFormattedTextField with the specified AbstractFormatterFactory.

Usage

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

private JFormattedTextField getCurrencyJFormattedTextField() {
    NumberFormat format = NumberFormat.getNumberInstance();
    format.setMaximumFractionDigits(3);/*from   ww w .  j  a v  a2s  .  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;
}

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

private JFormattedTextField getUnitJFormattedTextField() {
    NumberFormat format = new DecimalFormat("#,##0.###");
    NumberFormatter formatter = new NumberFormatter(format);
    formatter.setMinimum(1.0);//  w w  w.  j a  v  a 2  s.com
    formatter.setValueClass(Double.class);
    JFormattedTextField field = new JFormattedTextField(formatter);
    return field;
}

From source file:pcgen.gui2.tabs.SummaryInfoTab.java

SummaryInfoTab() {
    this.tabTitle = new TabTitle(Tab.SUMMARY);
    this.basicsPanel = new JPanel();
    this.todoPanel = new JPanel();
    this.scoresPanel = new JPanel();
    this.racePanel = new JPanel();
    this.classPanel = new JPanel();
    this.characterNameField = new JTextField();
    this.characterTypeComboBox = new JComboBox<>();
    this.random = new JButton();
    FontManipulation.xsmall(random);/*from   w w  w .  jav  a 2 s . c  om*/
    this.playerNameField = new JTextField();
    this.expField = new JFormattedTextField(NumberFormat.getIntegerInstance());
    this.nextlevelField = new JFormattedTextField(NumberFormat.getIntegerInstance());
    this.xpTableComboBox = new JComboBox<>();
    this.expmodField = new JFormattedTextField(NumberFormat.getIntegerInstance());
    this.addLevelsField = new JFormattedTextField(NumberFormat.getIntegerInstance());
    this.removeLevelsField = new JFormattedTextField(NumberFormat.getIntegerInstance());
    this.statsTable = new JTable();
    this.classLevelTable = new JTable();
    this.languageTable = new JTable();
    this.genderComboBox = new JComboBox<>();
    this.handsComboBox = new JComboBox<>();
    this.alignmentComboBox = new JComboBox<>();
    this.deityComboBox = new JComboBox<>();
    this.raceComboBox = new JComboBox<>();
    this.ageComboBox = new JComboBox<>();
    this.classComboBox = new JComboBox<>();
    this.tabLabelField = new JTextField();
    this.ageField = new JFormattedTextField(NumberFormat.getIntegerInstance());
    this.generateRollsButton = new JButton();
    this.rollMethodButton = new JButton();
    this.createMonsterButton = new JButton();
    this.addLevelsButton = new JButton();
    this.removeLevelsButton = new JButton();
    this.expaddButton = new JButton();
    this.expsubtractButton = new JButton();
    this.hpButton = new JButton();
    this.totalHPLabel = new JLabel();
    this.infoPane = new JEditorPane();
    this.statTotalLabel = new JLabel();
    this.statTotal = new JLabel();
    this.modTotalLabel = new JLabel();
    this.modTotal = new JLabel();
    this.todoPane = new JEditorPane();
    this.infoBoxRenderer = new InfoBoxRenderer();
    this.classBoxRenderer = new ClassBoxRenderer();
    initComponents();
}