Mega Code Archive

 
Categories / Java / Swing JFC
 

Creating a Text Field to Display and Edit a Number

import java.text.NumberFormat; import javax.swing.JFormattedTextField; public class Main {   public static void main(String[] argv) {     JFormattedTextField tft1 = new JFormattedTextField(NumberFormat.getIntegerInstance());     tft1.setValue(new Integer(123));     Integer intValue = (Integer) tft1.getValue();   } }