Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.text.DecimalFormat;

import javax.swing.JFormattedTextField;

public class Main {
    public static void main(String[] argv) throws Exception {
        JFormattedTextField tft2 = new JFormattedTextField(new DecimalFormat("#.0"));
        tft2.setValue(new Float(123.4F));

        // Retrieve the value from the text field
        Float floatValue = (Float) tft2.getValue();

    }
}